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
6 changes: 5 additions & 1 deletion app/controllers/concerns/saml_idp_auth_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ def add_sp_metadata_to_session
end

def requested_authn_context
@requested_authn_context ||= saml_request.requested_authn_context
@requested_authn_context ||= saml_request.requested_authn_context || default_authn_context
end

def default_authn_context
Saml::Idp::Constants::LOA1_AUTHN_CONTEXT_CLASSREF
end

def link_identity_from_session_data
Expand Down
16 changes: 3 additions & 13 deletions spec/controllers/saml_idp_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,24 +210,14 @@
end

context 'authn_context is missing' do
it 'renders nothing with a 401 error' do
it 'defaults to LOA1' do
stub_analytics
allow(@analytics).to receive(:track_event)

saml_get_auth(missing_authn_context_saml_settings)

expect(response.status).to eq(401)
expect(response.body).to be_empty

analytics_hash = {
authn_context: nil,
errors: ['Unauthorized authentication context'],
service_provider: 'http://localhost:3000',
valid: false,
}

expect(@analytics).to have_received(:track_event).
with(Analytics::SAML_AUTH, analytics_hash)
expect(response.status).to eq(302)
expect(@analytics).to_not have_received(:track_event)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why expect no analytics? Shouldn't it capture the Analytics::SAML_AUTH event with an LOA1 attribute?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@monfresh you are probably right. I will revisit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #1184

end
end

Expand Down