@Override
    protected JWTClaimsSet finalizeClaims(final JWTClaimsSet claimsSet, final JwtRequest payload) throws Exception {
        val jwtClaims = JwtClaims.parse(claimsSet.toString());
        if (jwtClaims.hasClaim(OAuth20Constants.SCOPE) && jwtClaims.isClaimValueStringList(OAuth20Constants.SCOPE)) {
            jwtClaims.setClaim(OAuth20Constants.SCOPE, String.join(" ", jwtClaims.getStringListClaimValue(OAuth20Constants.SCOPE)));
        }
        return JWTClaimsSet.parse(jwtClaims.getClaimsMap());
    }
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