Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
saml_idp (0.20.3.pre.18f)
saml_idp (0.21.0.pre.18f)
activesupport
builder
faraday
Expand Down
4 changes: 2 additions & 2 deletions lib/saml_idp/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ def requested_aal_authn_context
end.first
end

def requested_vtr_authn_context
def requested_vtr_authn_contexts
requested_authn_contexts.select do |classref|
VTR_REGEXP.match?(classref)
end.first
end
end

def acs_url
Expand Down
2 changes: 1 addition & 1 deletion lib/saml_idp/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module SamlIdp
VERSION = '0.20.3-18f'.freeze
VERSION = '0.21.0-18f'.freeze
end
24 changes: 16 additions & 8 deletions spec/lib/saml_idp/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,30 +250,38 @@ module SamlIdp
end
end

describe '#requested_vtr_authn_context' do
describe '#requested_vtr_authn_contexts' do
subject { described_class.new raw_authn_request }

context 'no vtr context requested' do
let(:authn_context_classref) { '' }

it 'returns nil' do
expect(subject.requested_vtr_authn_context).to be_nil
it 'returns an empty array' do
expect(subject.requested_vtr_authn_contexts).to eq([])
end
end

context 'only vtr is requested' do
let(:authn_context_classref) { build_authn_context_classref(vtr) }

it 'returns the vrt' do
expect(subject.requested_vtr_authn_context).to eq(vtr)
expect(subject.requested_vtr_authn_contexts).to eq([vtr])
end
end

context 'multiple contexts including vtr' do
context 'multiple contexts including vtr and an old ACR context' do
let(:authn_context_classref) { build_authn_context_classref([vtr, ial]) }

it 'returns the vrt' do
expect(subject.requested_vtr_authn_context).to eq(vtr)
expect(subject.requested_vtr_authn_contexts).to eq([vtr])
end
end

context 'multiple contexts that are vectors of trust' do
let(:authn_context_classref) { build_authn_context_classref(['C1.C2.P1.Pb', 'C1.C2.P1']) }

it 'returns all of the vectors in an array' do
expect(subject.requested_vtr_authn_contexts).to eq(['C1.C2.P1.Pb', 'C1.C2.P1'])
end
end

Expand All @@ -284,7 +292,7 @@ module SamlIdp
end

it 'does not match on the context' do
expect(subject.requested_vtr_authn_context).to be_nil
expect(subject.requested_vtr_authn_contexts).to eq([])
end
end

Expand All @@ -293,7 +301,7 @@ module SamlIdp
let(:authn_context_classref) { build_authn_context_classref(aal) }

it 'does not match on the context' do
expect(subject.requested_vtr_authn_context).to be_nil
expect(subject.requested_vtr_authn_contexts).to eq([])
end
end
end
Expand Down