@Override
    public Map<String, List<Object>> getAttributesInternal(final RegisteredServiceAttributeReleasePolicyContext context,
                                                           final Map<String, List<Object>> attributes) {
        val resolvedAttributes = new TreeMap<String, List<Object>>(String.CASE_INSENSITIVE_ORDER);
        resolvedAttributes.putAll(attributes);

        val attributesToRelease = new HashMap<String, List<Object>>(attributes.size());
        LOGGER.debug("Attempting to map and filter claims based on resolved attributes [{}]", resolvedAttributes);

        val allowedClaims = new LinkedHashSet<>(getAllowedAttributes());
        if (claimsMustBeDefinedViaDiscovery()) {
            val properties = context.getApplicationContext().getBean(CasConfigurationProperties.class);
            val supportedClaims = properties.getAuthn().getOidc().getDiscovery().getClaims();
            allowedClaims.retainAll(supportedClaims);
            LOGGER.debug("[{}] is designed to allow claims [{}] for scope [{}]. After cross-checking with "
                    + "supported claims [{}], the final collection of allowed attributes is [{}]",
                getClass().getSimpleName(), getAllowedAttributes(), getScopeType(), supportedClaims, allowedClaims);
        } else {
            LOGGER.debug("[{}] is designed to allow claims [{}].", getClass().getSimpleName(), allowedClaims);
        }

        allowedClaims
            .stream()
            .map(Unchecked.function(claim -> mapClaimToAttribute(claim, context, resolvedAttributes)))
            .filter(p -> Objects.nonNull(p.getValue()))
            .forEach(p -> attributesToRelease.put(p.getKey(), CollectionUtils.toCollection(p.getValue(), ArrayList.class)));
        return attributesToRelease;
    }
This is {@link BaseOidcScopeAttributeReleasePolicy}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-oidc-core/src/main/java/org/apereo/cas/oidc/claims/BaseOidcScopeAttributeReleasePolicy.java