Skip to content

Commit 74ed8df

Browse files
committed
Rename usage of deprecated SAML options
1 parent 71d61c2 commit 74ed8df

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

README.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ Use the SAML strategy as a middleware in your application:
3131
require 'omniauth'
3232
use OmniAuth::Strategies::SAML,
3333
:assertion_consumer_service_url => "consumer_service_url",
34-
:issuer => "issuer",
35-
:idp_sso_target_url => "idp_sso_target_url",
36-
:idp_sso_target_url_runtime_params => {:original_request_param => :mapped_idp_param},
34+
:sp_entity_id => "sp_entity_id",
35+
:idp_sso_service_url => "idp_sso_service_url",
36+
:idp_sso_service_url_runtime_params => {:original_request_param => :mapped_idp_param},
3737
:idp_cert => "-----BEGIN CERTIFICATE-----\n...-----END CERTIFICATE-----",
3838
:idp_cert_multi => {
3939
:signing => ["-----BEGIN CERTIFICATE-----\n...-----END CERTIFICATE-----", "-----BEGIN CERTIFICATE-----\n...-----END CERTIFICATE-----", ...],
@@ -58,9 +58,9 @@ and in `config/initializers/omniauth.rb`:
5858
Rails.application.config.middleware.use OmniAuth::Builder do
5959
provider :saml,
6060
:assertion_consumer_service_url => "consumer_service_url",
61-
:issuer => "rails-application",
62-
:idp_sso_target_url => "idp_sso_target_url",
63-
:idp_sso_target_url_runtime_params => {:original_request_param => :mapped_idp_param},
61+
:sp_entity_id => "rails-application",
62+
:idp_sso_service_url => "idp_sso_service_url",
63+
:idp_sso_service_url_runtime_params => {:original_request_param => :mapped_idp_param},
6464
:idp_cert => "-----BEGIN CERTIFICATE-----\n...-----END CERTIFICATE-----",
6565
:idp_cert_multi => {
6666
:signing => ["-----BEGIN CERTIFICATE-----\n...-----END CERTIFICATE-----", "-----BEGIN CERTIFICATE-----\n...-----END CERTIFICATE-----", ...],
@@ -72,7 +72,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do
7272
end
7373
```
7474

75-
For IdP-initiated SSO, users should directly access the IdP SSO target URL. Set the `href` of your application's login link to the value of `idp_sso_target_url`. For SP-initiated SSO, link to `/auth/saml`.
75+
For IdP-initiated SSO, users should directly access the IdP SSO service URL. Set the `href` of your application's login link to the value of `idp_sso_service_url`. For SP-initiated SSO, link to `/auth/saml`.
7676

7777
A `OneLogin::RubySaml::Response` object is added to the `env['omniauth.auth']` extra attribute, so we can use it in the controller via `env['omniauth.auth'].extra.response_object`
7878

@@ -88,13 +88,13 @@ Note that when [integrating with Devise](#devise-integration), the URL path will
8888
received. If not provided, defaults to the OmniAuth callback URL (typically
8989
`http://example.com/auth/saml/callback`). Optional.
9090

91-
* `:issuer` - The name of your application. Some identity providers might need this
91+
* `:sp_entity_id` - The name of your application. Some identity providers might need this
9292
to establish the identity of the service provider requesting the login. **Required**.
9393

94-
* `:idp_sso_target_url` - The URL to which the authentication request should be sent.
94+
* `:idp_sso_service_url` - The URL to which the authentication request should be sent.
9595
This would be on the identity provider. **Required**.
9696

97-
* `:idp_slo_target_url` - The URL to which the single logout request and response should
97+
* `:idp_slo_service_url` - The URL to which the single logout request and response should
9898
be sent. This would be on the identity provider. Optional.
9999

100100
* `:idp_slo_session_destroy` - A proc that accepts up to two parameters (the rack environment, and the session),
@@ -106,7 +106,7 @@ Note that when [integrating with Devise](#devise-integration), the URL path will
106106
instance will be passed to this callable if it has an arity of 1. If the value is a string,
107107
the string will be returned, when the `RelayState` is called. Optional.
108108

109-
* `:idp_sso_target_url_runtime_params` - A dynamic mapping of request params that exist
109+
* `:idp_sso_service_url_runtime_params` - A dynamic mapping of request params that exist
110110
during the request phase of OmniAuth that should to be sent to the IdP after a specific
111111
mapping. So for example, a param `original_request_param` with value `original_param_value`,
112112
could be sent to the IdP on the login request as `mapped_idp_param` with value
@@ -170,7 +170,7 @@ idp_metadata = idp_metadata_parser.parse_remote_to_hash("http://idp.example.com/
170170
use OmniAuth::Strategies::SAML,
171171
idp_metadata.merge(
172172
:assertion_consumer_service_url => "consumer_service_url",
173-
:issuer => "issuer"
173+
:sp_entity_id => "sp_entity_id"
174174
)
175175
```
176176

@@ -186,7 +186,7 @@ In `config/initializers/devise.rb`:
186186
Devise.setup do |config|
187187
config.omniauth :saml,
188188
idp_cert_fingerprint: 'fingerprint',
189-
idp_sso_target_url: 'target_url'
189+
idp_sso_service_url: 'idp_sso_service_url'
190190
end
191191
```
192192

@@ -196,7 +196,7 @@ Then follow Devise's general [OmniAuth tutorial](https://github.com/plataformate
196196

197197
Single Logout can be Service Provider initiated or Identity Provider initiated.
198198

199-
For SP initiated logout, the `idp_slo_target_url` option must be set to the logout url on the IdP,
199+
For SP initiated logout, the `idp_slo_service_url` option must be set to the logout url on the IdP,
200200
and users directed to `user_saml_omniauth_authorize_path + '/spslo'` after logging out locally. For
201201
IdP initiated logout, logout requests from the IdP should go to `/auth/saml/slo` (this can be
202202
advertised in metadata by setting the `single_logout_service_url` config option).
@@ -226,7 +226,7 @@ class SessionsController < Devise::SessionsController
226226
# ...
227227

228228
def after_sign_out_path_for(_)
229-
if session['saml_uid'] && session['saml_session_index'] && SAML_SETTINGS.idp_slo_target_url
229+
if session['saml_uid'] && session['saml_session_index'] && SAML_SETTINGS.idp_slo_service_url
230230
user_saml_omniauth_authorize_path + "/spslo"
231231
else
232232
super

lib/omniauth/strategies/saml.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def self.inherited(subclass)
1313
RUBYSAML_RESPONSE_OPTIONS = OneLogin::RubySaml::Response::AVAILABLE_OPTIONS
1414

1515
option :name_identifier_format, nil
16-
option :idp_sso_target_url_runtime_params, {}
16+
option :idp_sso_service_url_runtime_params, {}
1717
option :request_attributes, [
1818
{ :name => 'email', :name_format => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', :friendly_name => 'Email address' },
1919
{ :name => 'name', :name_format => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', :friendly_name => 'Full name' },
@@ -264,7 +264,7 @@ def other_phase_for_slo
264264
end
265265

266266
def other_phase_for_spslo
267-
if options.idp_slo_target_url
267+
if options.idp_slo_service_url
268268
with_settings do |settings|
269269
redirect(generate_logout_request(settings))
270270
end
@@ -275,7 +275,7 @@ def other_phase_for_spslo
275275

276276
def add_request_attributes_to(settings)
277277
settings.attribute_consuming_service.service_name options.attribute_service_name
278-
settings.issuer = options.issuer
278+
settings.sp_entity_id = options.sp_entity_id
279279

280280
options.request_attributes.each do |attribute|
281281
settings.attribute_consuming_service.add_attribute attribute
@@ -284,7 +284,7 @@ def add_request_attributes_to(settings)
284284

285285
def additional_params_for_authn_request
286286
{}.tap do |additional_params|
287-
runtime_request_parameters = options.delete(:idp_sso_target_url_runtime_params)
287+
runtime_request_parameters = options.delete(:idp_sso_service_url_runtime_params)
288288

289289
if runtime_request_parameters
290290
runtime_request_parameters.each_pair do |request_param_key, mapped_param_key|

spec/omniauth/strategies/saml_spec.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ def post_xml(xml = :example_response, opts = {})
1818
{
1919
:assertion_consumer_service_url => "http://localhost:9080/auth/saml/callback",
2020
:single_logout_service_url => "http://localhost:9080/auth/saml/slo",
21-
:idp_sso_target_url => "https://idp.sso.example.com/signon/29490",
22-
:idp_slo_target_url => "https://idp.sso.example.com/signoff/29490",
21+
:idp_sso_service_url => "https://idp.sso.example.com/signon/29490",
22+
:idp_slo_service_url => "https://idp.sso.example.com/signoff/29490",
2323
:idp_cert_fingerprint => "C1:59:74:2B:E8:0C:6C:A9:41:0F:6E:83:F6:D1:52:25:45:58:89:FB",
24-
:idp_sso_target_url_runtime_params => {:original_param_key => :mapped_param_key},
24+
:idp_sso_service_url_runtime_params => {:original_param_key => :mapped_param_key},
2525
:name_identifier_format => "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
2626
:request_attributes => [
2727
{ :name => 'email', :name_format => 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', :friendly_name => 'Email address' },
@@ -306,7 +306,7 @@ def post_xml(xml = :example_response, opts = {})
306306

307307
context "when response is a logout response" do
308308
before :each do
309-
saml_options[:issuer] = "https://idp.sso.example.com/metadata/29490"
309+
saml_options[:sp_entity_id] = "https://idp.sso.example.com/metadata/29490"
310310

311311
post "/auth/saml/slo", {
312312
SAMLResponse: load_xml(:example_logout_response),
@@ -323,7 +323,7 @@ def post_xml(xml = :example_response, opts = {})
323323
subject { post "/auth/saml/slo", params, "rack.session" => { "saml_uid" => "[email protected]" } }
324324

325325
before :each do
326-
saml_options[:issuer] = "https://idp.sso.example.com/metadata/29490"
326+
saml_options[:sp_entity_id] = "https://idp.sso.example.com/metadata/29490"
327327
end
328328

329329
let(:params) do
@@ -392,8 +392,8 @@ def test_default_relay_state(static_default_relay_state = nil, &block_default_re
392392
end
393393
end
394394

395-
it "should give not implemented without an idp_slo_target_url" do
396-
saml_options.delete(:idp_slo_target_url)
395+
it "should give not implemented without an idp_slo_service_url" do
396+
saml_options.delete(:idp_slo_service_url)
397397
post "/auth/saml/spslo"
398398

399399
expect(last_response.status).to eq 501
@@ -404,7 +404,7 @@ def test_default_relay_state(static_default_relay_state = nil, &block_default_re
404404

405405
describe 'POST /auth/saml/metadata' do
406406
before do
407-
saml_options[:issuer] = 'http://example.com/SAML'
407+
saml_options[:sp_entity_id] = 'http://example.com/SAML'
408408
post '/auth/saml/metadata'
409409
end
410410

0 commit comments

Comments
 (0)