@Override
    protected Map<String, List<Object>> collectClaims(final JwtRequest payload) throws Throwable {
        val currentClaims = super.collectClaims(payload);
        if (payload.isResolveSubject() && payload.getRegisteredService().isPresent()) {
            val principal = getPrincipalResolver().resolve(new BasicIdentifiableCredential(payload.getSubject()));
            val registeredService = payload.getRegisteredService().get();
            val context = RegisteredServiceAttributeReleasePolicyContext.builder()
                .principal(principal)
                .service(payload.getService().orElse(null))
                .registeredService(registeredService)
                .applicationContext(getApplicationContext())
                .build();
            currentClaims.putAll(registeredService.getAttributeReleasePolicy().getAttributes(context));
        }
        return currentClaims;
    }
This is {@link OAuth20JwtBuilder}.

@author Misagh Moayyed
@since 6.1.0
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/ticket/accesstoken/OAuth20JwtBuilder.java