-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Perform ial and aal determination in the idp app (#11160)
This was unnecessarily leaking into the saml_idp gem. A separate PR (18F/saml_idp#117) in that repo will remove these concerns from there. See https://gitlab.login.gov/lg-people/Melba/backlog-fy24/-/issues/95 changelog: Internal, Refactoring, Refactor saml_request.requested_ial_authn_context calls to single place
- Loading branch information
Showing
9 changed files
with
105 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
require 'rails_helper' | ||
|
||
module FederatedProtocols | ||
RSpec.describe Saml do | ||
let(:authn_contexts) { [] } | ||
let(:saml_request) { instance_double(SamlIdp::Request) } | ||
|
||
subject { FederatedProtocols::Saml.new saml_request } | ||
|
||
before do | ||
allow(saml_request).to receive(:requested_authn_contexts).and_return(authn_contexts) | ||
end | ||
|
||
describe '#aal' do | ||
context 'when no aal context is requested' do | ||
it 'returns nil' do | ||
expect(subject.aal).to be_nil | ||
end | ||
end | ||
|
||
context 'when the only context requested is aal' do | ||
let(:aal) { 'http://idmanagement.gov/ns/assurance/aal/2' } | ||
let(:authn_contexts) { [aal] } | ||
|
||
it 'returns the requested aal' do | ||
expect(subject.aal).to eq(aal) | ||
end | ||
end | ||
|
||
context 'when multiple contexts are requested including aal' do | ||
let(:aal) { 'http://idmanagement.gov/ns/assurance/aal/2' } | ||
let(:ial) { 'http://idmanagement.gov/ns/assurance/ial/1' } | ||
let(:authn_contexts) { [ial, aal] } | ||
|
||
it 'returns the requested aal' do | ||
expect(subject.aal).to eq(aal) | ||
end | ||
end | ||
end | ||
|
||
describe '#requested_ial_authn_context' do | ||
context 'when no ial context is requested' do | ||
it 'returns nil' do | ||
expect(subject.requested_ial_authn_context).to be_nil | ||
end | ||
end | ||
|
||
context 'when the only context requested is ial' do | ||
let(:ial) { 'http://idmanagement.gov/ns/assurance/ial/2' } | ||
let(:authn_contexts) { [ial] } | ||
|
||
it 'returns the requested ial' do | ||
expect(subject.requested_ial_authn_context).to eq(ial) | ||
end | ||
end | ||
|
||
context 'when multiple contexts are requested including ial' do | ||
let(:aal) { 'http://idmanagement.gov/ns/assurance/aal/2' } | ||
let(:ial) { 'http://idmanagement.gov/ns/assurance/ial/1' } | ||
let(:authn_contexts) { [ial, aal] } | ||
|
||
it 'returns the requested ial' do | ||
expect(subject.requested_ial_authn_context).to eq(ial) | ||
end | ||
end | ||
end | ||
end | ||
end |