Skip to content

Commit 4a2a5ef

Browse files
committed
fix: default assertion_consumer_service_url not set during callback
Fix a bug where ruby-saml would fail SubjectConfirmation Recipient validation when using the default assertion_consumer_service_url. The url was not being set during the callback phase. This closes #139
1 parent 3787dfb commit 4a2a5ef

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

lib/omniauth/strategies/saml.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ def self.inherited(subclass)
3232
option :idp_slo_session_destroy, proc { |_env, session| session.clear }
3333

3434
def request_phase
35-
options[:assertion_consumer_service_url] ||= callback_url
36-
3735
authn_request = OneLogin::RubySaml::Authrequest.new
3836

3937
with_settings do |settings|
@@ -212,6 +210,7 @@ def generate_logout_request(settings)
212210
end
213211

214212
def with_settings
213+
options[:assertion_consumer_service_url] ||= callback_url
215214
yield OneLogin::RubySaml::Settings.new(options)
216215
end
217216

spec/omniauth/strategies/saml_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ def post_xml(xml=:example_response, opts = {})
157157
end
158158
end
159159

160+
context "when the assertion_consumer_service_url is the default" do
161+
before :each do
162+
saml_options.delete(:assertion_consumer_service_url)
163+
OmniAuth.config.full_host = 'http://localhost:9080'
164+
post_xml
165+
end
166+
167+
it { is_expected.not_to fail_with(:invalid_ticket) }
168+
end
169+
160170
context "when there is no SAMLResponse parameter" do
161171
before :each do
162172
post '/auth/saml/callback'

0 commit comments

Comments
 (0)