Log incoming saml attributes from provider.

This commit is contained in:
Mark Cooper
2024-06-25 15:17:08 -07:00
committed by Ray Lee
parent 199a72d9c6
commit 2d35e5a3e5

View File

@@ -51,6 +51,12 @@ public class DSpaceSamlAuthenticationSuccessHandler implements AuthenticationSuc
String relyingPartyId = principal.getRelyingPartyRegistrationId(); String relyingPartyId = principal.getRelyingPartyRegistrationId();
Map<String, List<Object>> samlAttributes = principal.getAttributes(); Map<String, List<Object>> samlAttributes = principal.getAttributes();
samlAttributes.forEach((attributeName, values) -> {
values.forEach(value -> {
logger.info("Incoming SAML attribute: {} = {}", attributeName, value);
});
});
setRequestAttributesFromSamlAttributes(request, relyingPartyId, samlAttributes); setRequestAttributesFromSamlAttributes(request, relyingPartyId, samlAttributes);
request.setAttribute("org.dspace.saml.RELYING_PARTY_ID", relyingPartyId); request.setAttribute("org.dspace.saml.RELYING_PARTY_ID", relyingPartyId);
@@ -103,6 +109,8 @@ public class DSpaceSamlAuthenticationSuccessHandler implements AuthenticationSuc
if (values != null) { if (values != null) {
request.setAttribute(requestAttributeName, values); request.setAttribute(requestAttributeName, values);
} else {
logger.warn("No value found for SAML attribute {} in assertion", samlAttributeName);
} }
}); });
} }