use of org.apereo.cas.configuration.model.support.saml.idp.SamlIdPResponseProperties in project cas by apereo.
the class SamlProfileSamlAttributeStatementBuilder method buildAttributeStatement.
private AttributeStatement buildAttributeStatement(final Object casAssertion, final RequestAbstractType authnRequest, final SamlRegisteredService service, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor) throws SamlException {
final Assertion assertion = Assertion.class.cast(casAssertion);
final Map<String, Object> attributes = new HashMap<>(assertion.getAttributes());
attributes.putAll(assertion.getPrincipal().getAttributes());
final Map<String, Object> encodedAttrs = this.samlAttributeEncoder.encodeAttributes(attributes, service);
final SamlIdPResponseProperties resp = casProperties.getAuthn().getSamlIdp().getResponse();
final Map<String, String> nameFormats = new HashMap<>(resp.configureAttributeNameFormats());
nameFormats.putAll(service.getAttributeNameFormats());
return newAttributeStatement(encodedAttrs, service.getAttributeFriendlyNames(), nameFormats, resp.getDefaultAttributeNameFormat());
}
Aggregations