use of org.apereo.cas.ws.idp.WSFederationClaims in project cas by apereo.
the class WSFederationClaimsReleasePolicy method getAttributesInternal.
@Override
public Map<String, Object> getAttributesInternal(final Principal principal, final Map<String, Object> attrs, final RegisteredService service) {
final Map<String, Object> resolvedAttributes = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
resolvedAttributes.putAll(attrs);
final Map<String, Object> attributesToRelease = new HashMap<>(resolvedAttributes.size());
getAllowedAttributes().entrySet().stream().filter(entry -> WSFederationClaims.contains(entry.getKey().toUpperCase())).forEach(entry -> {
final String claimName = entry.getKey();
final String attributeName = entry.getValue();
final WSFederationClaims claim = WSFederationClaims.valueOf(claimName.toUpperCase());
LOGGER.debug("Evaluating claimName [{}] mapped to attribute name [{}]", claim.getUri(), attributeName);
final Object value = resolvedAttributes.get(attributeName);
if (value != null) {
LOGGER.debug("Adding claimName [{}] to the collection of released attributes", claim.getUri());
attributesToRelease.put(claim.getUri(), value);
}
});
return attributesToRelease;
}
Aggregations