private OAuth20AccessToken createAccessToken(final AccessTokenRequestContext tokenRequestContext,
                                                 final Authentication authentication) throws Throwable {
        val clientId = Optional.ofNullable(tokenRequestContext.getRegisteredService())
            .map(OAuthRegisteredService::getClientId).orElse(StringUtils.EMPTY);

        val accessTokenFactory = (OAuth20AccessTokenFactory) ticketFactory.get(OAuth20AccessToken.class);
        val ticketGrantingTicket = tokenRequestContext.getTicketGrantingTicket() == null || tokenRequestContext.getTicketGrantingTicket().isExpired()
            ? null : tokenRequestContext.getTicketGrantingTicket();
        LOGGER.debug("Creating access token for client id [{}] and authentication [{}]", clientId, authentication);
        return accessTokenFactory.create(tokenRequestContext.getService(),
            authentication,
            ticketGrantingTicket,
            tokenRequestContext.getScopes(),
            Optional.ofNullable(tokenRequestContext.getToken()).map(Ticket::getId).orElse(null),
            clientId,
            tokenRequestContext.getClaims(),
            tokenRequestContext.getResponseType(),
            tokenRequestContext.getGrantType());
    }
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