protected boolean shouldEncodeAsJwt() {
        val oauthRegisteredService = (OAuthRegisteredService) registeredService;
        val oauthProps = configurationContext.getCasProperties().getAuthn().getOauth();

        val dpopRequest = token.getAuthentication().containsAttribute(OAuth20Constants.DPOP);

        val accessTokenAsJwt = token instanceof OAuth20AccessToken
            && (oauthProps.getAccessToken().isCreateAsJwt() || oauthRegisteredService.isJwtAccessToken());
        val refreshTokenAsJwt = token instanceof OAuth20RefreshToken
            && (oauthProps.getRefreshToken().isCreateAsJwt() || oauthRegisteredService.isJwtRefreshToken());

        return this.forceEncodeAsJwt || accessTokenAsJwt || refreshTokenAsJwt || dpopRequest;
    }
This is {@link OAuth20JwtAccessTokenEncodableCipher}.

@author Misagh Moayyed
@since 7.2.0
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/accesstoken/response/OAuth20JwtAccessTokenEncodableCipher.java