protected Map<String, List<Object>> filterAttributesByScope(final Collection<String> scopes,
                                                                final Principal principal,
                                                                final Service service,
                                                                final OidcRegisteredService registeredService,
                                                                final OAuth20AccessToken accessToken) {
        if (scopes.isEmpty()) {
            LOGGER.info("No defined scopes are available to instruct attribute release policies for [{}]. "
                    + "CAS will NOT authorize the collection of resolved claims for release to [{}]",
                registeredService.getServiceId(), service.getId());
            return new HashMap<>();
        }

        val effectiveAttributeReleasePolicies = oidcAttributeReleasePolicyFactory.resolvePolicies(registeredService);
        val attributes = new LinkedHashMap<String, List<Object>>();
        scopes
            .stream()
            .distinct()
            .filter(effectiveAttributeReleasePolicies::containsKey)
            .map(scope -> {
                val policy = effectiveAttributeReleasePolicies.get(scope);
                return getAttributesFromPolicy(principal, service, registeredService, policy);
            })
            .forEach(attributes::putAll);

        effectiveAttributeReleasePolicies.values()
            .stream()
            .filter(OidcScopeFreeAttributeReleasePolicy.class::isInstance)
            .forEach(policy -> {
                val policyAttr = getAttributesFromPolicy(principal, service, registeredService, policy);
                attributes.putAll(policyAttr);
            });
        LOGGER.debug("Final collection of attributes based on scopes are [{}]", attributes);
        return attributes;
    }
This is {@link OidcProfileScopeToAttributesFilter}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/profile/OidcProfileScopeToAttributesFilter.java