-
Notifications
You must be signed in to change notification settings - Fork 167
Store passed AAL as text to preserve all AAL details #8012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class AddIdentitiesRequestedAalValue < ActiveRecord::Migration[7.0] | ||
| def change | ||
| add_column :identities, :requested_aal_value, :text | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -357,37 +357,19 @@ | |
| end | ||
|
|
||
| describe '#aal' do | ||
| context 'when DEFAULT_AAL passed' do | ||
Jeremy1026 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| before do | ||
| default = Saml::Idp::Constants::DEFAULT_AAL_AUTHN_CONTEXT_CLASSREF | ||
| IdentityConfig.store.valid_authn_contexts.push(default) | ||
| end | ||
|
|
||
| after do | ||
| IdentityConfig.store.valid_authn_contexts.pop | ||
| end | ||
|
|
||
| let(:acr_values) { Saml::Idp::Constants::DEFAULT_AAL_AUTHN_CONTEXT_CLASSREF } | ||
| context 'when no AAL passed' do | ||
| let(:acr_values) { Saml::Idp::Constants::IAL1_AUTHN_CONTEXT_CLASSREF } | ||
|
|
||
| it 'returns 0' do | ||
| expect(form.aal).to eq(Saml::Idp::Constants::DEFAULT_AAL_AUTHN_CONTEXT_CLASSREF) | ||
| expect(form.aal).to eq(0) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: should this return
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| end | ||
| end | ||
|
|
||
| context 'when AAL1 passed' do | ||
| before do | ||
| aal1 = Saml::Idp::Constants::AAL1_AUTHN_CONTEXT_CLASSREF | ||
| IdentityConfig.store.valid_authn_contexts.push(aal1) | ||
| end | ||
|
|
||
| after do | ||
| IdentityConfig.store.valid_authn_contexts.pop | ||
| end | ||
|
|
||
| let(:acr_values) { Saml::Idp::Constants::AAL1_AUTHN_CONTEXT_CLASSREF } | ||
| context 'when DEFAULT_AAL passed' do | ||
| let(:acr_values) { Saml::Idp::Constants::DEFAULT_AAL_AUTHN_CONTEXT_CLASSREF } | ||
|
|
||
| it 'returns 1' do | ||
| expect(form.aal).to eq(1) | ||
| it 'returns 0' do | ||
| expect(form.aal).to eq(0) | ||
| end | ||
| end | ||
|
|
||
|
|
@@ -430,9 +412,7 @@ | |
| expect(form.aal).to eq(3) | ||
| end | ||
| end | ||
| end | ||
|
|
||
| describe '#aal' do | ||
| context 'when IAL and AAL passed' do | ||
| aal2 = Saml::Idp::Constants::AAL2_AUTHN_CONTEXT_CLASSREF | ||
| ial2 = Saml::Idp::Constants::IAL2_AUTHN_CONTEXT_CLASSREF | ||
|
|
@@ -448,6 +428,100 @@ | |
| end | ||
| end | ||
|
|
||
| describe '#requested_aal_value' do | ||
| context 'when AAL2 passed' do | ||
| let(:acr_values) { Saml::Idp::Constants::AAL2_AUTHN_CONTEXT_CLASSREF } | ||
|
|
||
| it 'returns AAL2' do | ||
| expect(form.requested_aal_value).to eq(Saml::Idp::Constants::AAL2_AUTHN_CONTEXT_CLASSREF) | ||
| end | ||
| end | ||
|
|
||
| context 'when AAL2_PHISHING_RESISTANT passed' do | ||
| let(:acr_values) { Saml::Idp::Constants::AAL2_PHISHING_RESISTANT_AUTHN_CONTEXT_CLASSREF } | ||
|
|
||
| it 'returns AAL2+Phishing Resistant' do | ||
| expect(form.requested_aal_value).to eq( | ||
| Saml::Idp::Constants::AAL2_PHISHING_RESISTANT_AUTHN_CONTEXT_CLASSREF, | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| context 'when AAL2_HSPD12 passed' do | ||
| let(:acr_values) { Saml::Idp::Constants::AAL2_HSPD12_AUTHN_CONTEXT_CLASSREF } | ||
|
|
||
| it 'returns AAL2+HSPD12' do | ||
| expect(form.requested_aal_value).to eq( | ||
| Saml::Idp::Constants::AAL2_HSPD12_AUTHN_CONTEXT_CLASSREF, | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| context 'when AAL3 passed' do | ||
| let(:acr_values) { Saml::Idp::Constants::AAL3_AUTHN_CONTEXT_CLASSREF } | ||
|
|
||
| it 'returns AAL3' do | ||
| expect(form.requested_aal_value).to eq(Saml::Idp::Constants::AAL3_AUTHN_CONTEXT_CLASSREF) | ||
| end | ||
| end | ||
|
|
||
| context 'when AAL3_HSPD12 passed' do | ||
| let(:acr_values) { Saml::Idp::Constants::AAL3_HSPD12_AUTHN_CONTEXT_CLASSREF } | ||
|
|
||
| it 'returns AAL3+HSPD12' do | ||
| expect(form.requested_aal_value).to eq( | ||
| Saml::Idp::Constants::AAL3_HSPD12_AUTHN_CONTEXT_CLASSREF, | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| context 'when AAL3_HSPD12 and AAL2_HSPD12 passed' do | ||
| let(:acr_values) do | ||
| [Saml::Idp::Constants::AAL3_HSPD12_AUTHN_CONTEXT_CLASSREF, | ||
| Saml::Idp::Constants::AAL2_HSPD12_AUTHN_CONTEXT_CLASSREF].join(' ') | ||
| end | ||
|
|
||
| it 'returns AAL2+HSPD12' do | ||
| expect(form.requested_aal_value).to eq( | ||
| Saml::Idp::Constants::AAL2_HSPD12_AUTHN_CONTEXT_CLASSREF, | ||
| ) | ||
| end | ||
| end | ||
|
|
||
| context 'when AAL2 and AAL2_PHISHING_RESISTANT passed' do | ||
| let(:phishing_resistant) do | ||
| Saml::Idp::Constants::AAL2_PHISHING_RESISTANT_AUTHN_CONTEXT_CLASSREF | ||
| end | ||
|
|
||
| let(:acr_values) do | ||
| "#{Saml::Idp::Constants::AAL2_AUTHN_CONTEXT_CLASSREF} | ||
| #{phishing_resistant}" | ||
| end | ||
|
|
||
| it 'returns AAL2+HSPD12' do | ||
| expect(form.requested_aal_value).to eq(phishing_resistant) | ||
| end | ||
| end | ||
|
|
||
| context 'when AAL2_PHISHING_RESISTANT and AAL2 passed' do | ||
| # this is the same as the previous test, just reverse ordered | ||
| # AAL values, to ensure it doesn't just take the 2nd AAL. | ||
| let(:phishing_resistant) do | ||
| Saml::Idp::Constants::AAL2_PHISHING_RESISTANT_AUTHN_CONTEXT_CLASSREF | ||
| end | ||
|
|
||
| let(:acr_values) do | ||
| "#{phishing_resistant} | ||
| #{Saml::Idp::Constants::AAL2_AUTHN_CONTEXT_CLASSREF}" | ||
| end | ||
|
|
||
| it 'returns AAL2+HSPD12' do | ||
| requested_aal_value = form.requested_aal_value | ||
| expect(requested_aal_value).to eq(phishing_resistant) | ||
| end | ||
Jeremy1026 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| end | ||
| end | ||
|
|
||
| describe '#verified_within' do | ||
| context 'without a verified_within' do | ||
| let(:verified_within) { nil } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.