diff --git a/src/main/java/net/gepafin/tendermanagement/config/SecurityConfig.java b/src/main/java/net/gepafin/tendermanagement/config/SecurityConfig.java index 73213a77..409a4bb8 100644 --- a/src/main/java/net/gepafin/tendermanagement/config/SecurityConfig.java +++ b/src/main/java/net/gepafin/tendermanagement/config/SecurityConfig.java @@ -261,14 +261,19 @@ public class SecurityConfig { RelyingPartyRegistrationResolver registrationResolver = new DefaultRelyingPartyRegistrationResolver(registrations); OpenSaml4AuthenticationRequestResolver authenticationRequestResolver = new OpenSaml4AuthenticationRequestResolver(registrationResolver); - // Customize the AuthnRequest with the authentication context + // Customize and log the AuthnRequest after setting the context authenticationRequestResolver.setAuthnRequestCustomizer((context) -> { context.getAuthnRequest().setRequestedAuthnContext(buildRequestedAuthnContext()); + + // Log the SAML AuthnRequest after setting the authentication context + String samlRequest = context.getAuthnRequest().toString(); // Get the updated AuthnRequest + logger.info("SAML AuthnRequest after setting context: " + samlRequest); // Log the updated SAML request }); return authenticationRequestResolver; } + private RequestedAuthnContext buildRequestedAuthnContext() { AuthnContextClassRefBuilder authnContextClassRefBuilder = new AuthnContextClassRefBuilder(); AuthnContextClassRef authnContextClassRef = authnContextClassRefBuilder.buildObject(