Skip to content

Commit 6041b8d

Browse files
Merge pull request #92 from rnubel/extract-metadata-path-check
Extract metadata route logic to a separate method
2 parents 0fc5fcf + 9a33870 commit 6041b8d

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ env:
33
- JRUBY_OPTS="$JRUBY_OPTS --debug"
44
language: ruby
55
script: bundle exec rspec
6+
before_install: gem update bundler
67
matrix:
78
include:
89
- rvm: 1.9.3

lib/omniauth/strategies/saml.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,12 @@ def response_fingerprint
9696
Digest::SHA1.hexdigest(cert.to_der).upcase.scan(/../).join(':')
9797
end
9898

99+
def on_metadata_path?
100+
on_path?("#{request_path}/metadata")
101+
end
102+
99103
def other_phase
100-
if on_path?("#{request_path}/metadata")
104+
if on_metadata_path?
101105
# omniauth does not set the strategy on the other_phase
102106
@env['omniauth.strategy'] ||= self
103107
setup_phase

spec/omniauth/strategies/saml_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,8 @@ def post_xml(xml=:example_response)
218218
last_response.body.should match /Required attributes/
219219
end
220220
end
221+
222+
it 'implements #on_metadata_path?' do
223+
expect(described_class.new(nil)).to respond_to(:on_metadata_path?)
224+
end
221225
end

0 commit comments

Comments
 (0)