use of org.apereo.cas.oidc.claims.mapping.OidcAttributeToScopeClaimMapper in project cas by apereo.
the class BaseOidcScopeAttributeReleasePolicy method mapClaimToAttribute.
private Pair<String, Object> mapClaimToAttribute(final String claim, final Map<String, Object> resolvedAttributes) {
final ApplicationContext applicationContext = ApplicationContextProvider.getApplicationContext();
final OidcAttributeToScopeClaimMapper attributeToScopeClaimMapper = applicationContext.getBean("oidcAttributeToScopeClaimMapper", OidcAttributeToScopeClaimMapper.class);
LOGGER.debug("Attempting to process claim [{}]", claim);
if (attributeToScopeClaimMapper.containsMappedAttribute(claim)) {
final String mappedAttr = attributeToScopeClaimMapper.getMappedAttribute(claim);
final Object value = resolvedAttributes.get(mappedAttr);
LOGGER.debug("Found mapped attribute [{}] with value [{}] for claim [{}]", mappedAttr, value, claim);
return Pair.of(claim, value);
}
final Object value = resolvedAttributes.get(claim);
LOGGER.debug("No mapped attribute is defined for claim [{}]; Used [{}] to locate value [{}]", claim, claim, value);
return Pair.of(claim, value);
}
Aggregations