Search in sources :

Example 1 with SamlIdPResponseProperties

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());
}
Also used : SamlIdPResponseProperties(org.apereo.cas.configuration.model.support.saml.idp.SamlIdPResponseProperties) HashMap(java.util.HashMap) Assertion(org.jasig.cas.client.validation.Assertion)

Aggregations

HashMap (java.util.HashMap)1 SamlIdPResponseProperties (org.apereo.cas.configuration.model.support.saml.idp.SamlIdPResponseProperties)1 Assertion (org.jasig.cas.client.validation.Assertion)1