public static EncodableCipher<String, String> toEncodableCipher(
        final OAuth20ConfigurationContext configurationContext,
        final OAuth20AccessTokenResponseResult tokenResult,
        final OAuth20Token token,
        final String issuer) {
        val cipher = new OAuth20JwtAccessTokenEncodableCipher(configurationContext, tokenResult.getRegisteredService(),
            token, tokenResult.getService(), issuer,
            tokenResult.getRequestedTokenType() == OAuth20TokenExchangeTypes.JWT);
        if (tokenResult.getGrantType() == OAuth20GrantTypes.TOKEN_EXCHANGE && tokenResult.getRequestedTokenType() == OAuth20TokenExchangeTypes.JWT) {
            val audience = Optional.ofNullable(tokenResult.getTokenExchangeAudience())
                .or(() -> Optional.ofNullable(tokenResult.getTokenExchangeResource()).map(Service::getId))
                .orElse(StringUtils.EMPTY);
            cipher.setTokenAudience(audience);
        }
        return cipher;
    }
To encodable cipher.

@param configurationContext the configuration context
@param tokenResult          the token result
@param token          the access token
@param issuer               the issuer
@return the encodable cipher
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/accesstoken/response/OAuth20JwtAccessTokenEncoder.java