Skip to content

Commit

Permalink
Log requesting signing and certificate serial in SAML Auth Request ev…
Browse files Browse the repository at this point in the history
…ent (#11558)

changelog: Internal, Logging, Log requesting signing and certificate serial in SAML Auth Request event
  • Loading branch information
mitchellhenke authored Nov 26, 2024
1 parent 3f0fd8c commit fba9f9b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/controllers/saml_idp_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ def log_external_saml_auth_request
force_authn: saml_request&.force_authn?,
final_auth_request: sp_session[:final_auth_request],
service_provider: saml_request&.issuer,
request_signed: saml_request.signed?,
matching_cert_serial:,
unknown_authn_contexts:,
user_fully_authenticated: user_fully_authenticated?,
)
Expand Down
6 changes: 6 additions & 0 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6505,6 +6505,8 @@ def saml_auth(
# @param [Boolean] force_authn
# @param [Boolean] final_auth_request
# @param [String] service_provider
# @param [Boolean] request_signed
# @param [String] matching_cert_serial
# @param [String] unknown_authn_contexts space separated list of unknown contexts
# @param [Boolean] user_fully_authenticated
# An external request for SAML Authentication was received
Expand All @@ -6516,6 +6518,8 @@ def saml_auth_request(
force_authn:,
final_auth_request:,
service_provider:,
request_signed:,
matching_cert_serial:,
unknown_authn_contexts:,
user_fully_authenticated:,
**extra
Expand All @@ -6529,6 +6533,8 @@ def saml_auth_request(
force_authn:,
final_auth_request:,
service_provider:,
request_signed:,
matching_cert_serial:,
unknown_authn_contexts:,
user_fully_authenticated:,
**extra,
Expand Down
13 changes: 13 additions & 0 deletions spec/controllers/saml_idp_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,8 @@ def name_id_version(format_urn)
requested_ial: Saml::Idp::Constants::IAL2_AUTHN_CONTEXT_CLASSREF,
service_provider: sp1_issuer,
force_authn: false,
request_signed: true,
matching_cert_serial: saml_test_sp_cert_serial,
user_fully_authenticated: true,
}
)
Expand Down Expand Up @@ -930,6 +932,8 @@ def name_id_version(format_urn)
requested_ial: 'ialmax',
service_provider: sp1_issuer,
force_authn: false,
request_signed: true,
matching_cert_serial: saml_test_sp_cert_serial,
user_fully_authenticated: true,
}
)
Expand Down Expand Up @@ -1221,6 +1225,8 @@ def name_id_version(format_urn)
requested_ial: Saml::Idp::Constants::IAL1_AUTHN_CONTEXT_CLASSREF,
service_provider: 'http://localhost:3000',
requested_aal_authn_context: Saml::Idp::Constants::DEFAULT_AAL_AUTHN_CONTEXT_CLASSREF,
request_signed: true,
matching_cert_serial: saml_test_sp_cert_serial,
force_authn: true,
user_fully_authenticated: false,
}
Expand Down Expand Up @@ -2030,6 +2036,8 @@ def name_id_version(format_urn)
requested_ial: Saml::Idp::Constants::IAL1_AUTHN_CONTEXT_CLASSREF,
service_provider: 'http://localhost:3000',
requested_aal_authn_context: Saml::Idp::Constants::DEFAULT_AAL_AUTHN_CONTEXT_CLASSREF,
request_signed: true,
matching_cert_serial: saml_test_sp_cert_serial,
force_authn: false,
user_fully_authenticated: false,
}
Expand Down Expand Up @@ -2464,6 +2472,7 @@ def name_id_version(format_urn)
service_provider: 'http://localhost:3000',
requested_aal_authn_context: Saml::Idp::Constants::AAL2_AUTHN_CONTEXT_CLASSREF,
force_authn: false,
request_signed: false,
user_fully_authenticated: true,
}
)
Expand Down Expand Up @@ -2515,6 +2524,8 @@ def stub_requested_attributes
service_provider: 'http://localhost:3000',
requested_aal_authn_context: Saml::Idp::Constants::DEFAULT_AAL_AUTHN_CONTEXT_CLASSREF,
force_authn: false,
request_signed: true,
matching_cert_serial: saml_test_sp_cert_serial,
user_fully_authenticated: true,
}
)
Expand Down Expand Up @@ -2565,6 +2576,8 @@ def stub_requested_attributes
service_provider: 'http://localhost:3000',
requested_aal_authn_context: Saml::Idp::Constants::DEFAULT_AAL_AUTHN_CONTEXT_CLASSREF,
force_authn: false,
request_signed: true,
matching_cert_serial: saml_test_sp_cert_serial,
user_fully_authenticated: true,
}
)
Expand Down
6 changes: 6 additions & 0 deletions spec/features/saml/saml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,8 @@
service_provider: 'http://localhost:3000',
requested_aal_authn_context: Saml::Idp::Constants::DEFAULT_AAL_AUTHN_CONTEXT_CLASSREF,
force_authn: false,
matching_cert_serial: saml_test_sp_cert_serial,
request_signed: true,
user_fully_authenticated: false }],
)
expect(fake_analytics.events['SAML Auth'].count).to eq 2
Expand Down Expand Up @@ -551,6 +553,8 @@
requested_ial: 'http://idmanagement.gov/ns/assurance/ial/2',
service_provider: 'saml_sp_ial2',
force_authn: false,
matching_cert_serial: saml_test_sp_cert_serial,
request_signed: true,
user_fully_authenticated: false,
},
],
Expand Down Expand Up @@ -581,6 +585,8 @@
service_provider: 'http://localhost:3000',
requested_aal_authn_context: Saml::Idp::Constants::DEFAULT_AAL_AUTHN_CONTEXT_CLASSREF,
force_authn: false,
matching_cert_serial: saml_test_sp_cert_serial,
request_signed: true,
user_fully_authenticated: false }],
)
expect(fake_analytics.events['SAML Auth'].count).to eq 2
Expand Down

0 comments on commit fba9f9b

Please sign in to comment.