protected AccessAndRefreshTokens generateAccessTokenForTokenExchange(final AccessTokenRequestContext tokenRequestContext) throws Throwable {
        val targetService = Objects.requireNonNullElseGet(tokenRequestContext.getTokenExchangeResource(), tokenRequestContext::getService);
        return switch (tokenRequestContext.getRequestedTokenType()) {
            case ACCESS_TOKEN, JWT -> {
                val subjectToken = (OAuth20AccessToken) tokenRequestContext.getSubjectToken();
                val exchangedAccessToken = exchangeTokenForAccessToken(targetService, subjectToken, tokenRequestContext);
                val addedAccessToken = addAccessToken(tokenRequestContext, exchangedAccessToken);
                yield new AccessAndRefreshTokens(addedAccessToken, null);
            }
            default -> {
                val subjectToken = (OAuth20AccessToken) tokenRequestContext.getSubjectToken();
                val exchangedAccessToken = exchangeTokenForAccessToken(targetService, subjectToken, tokenRequestContext);
                yield new AccessAndRefreshTokens(exchangedAccessToken, null);
            }
        };
    }
This is {@link OAuth20DefaultTokenGenerator}.

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