protected AuthenticationBuilder prepareAuthentication(final AccessTokenRequestContext tokenRequestContext) {
        val ticketGrantingTicket = tokenRequestContext.getTicketGrantingTicket();
        var existingAuthn = tokenRequestContext.getAuthentication();
        if (existingAuthn == null && ticketGrantingTicket instanceof final AuthenticationAwareTicket aat) {
            existingAuthn = aat.getAuthentication();
        }
        val authnBuilder = DefaultAuthenticationBuilder
            .newInstance(existingAuthn)
            .setAuthenticationDate(ZonedDateTime.now(ZoneOffset.UTC))
            .addAttribute(OAuth20Constants.GRANT_TYPE, tokenRequestContext.getGrantType().getType())
            .addAttribute(OAuth20Constants.SCOPE, tokenRequestContext.getScopes());

        val requestedClaims = tokenRequestContext.getClaims().getOrDefault(OAuth20Constants.CLAIMS_USERINFO, new HashMap<>());
        requestedClaims.forEach(authnBuilder::addAttribute);

        FunctionUtils.doIfNotNull(tokenRequestContext.getDpop(),
            __ -> authnBuilder.addAttribute(OAuth20Constants.DPOP, tokenRequestContext.getDpop()));
        FunctionUtils.doIfNotNull(tokenRequestContext.getDpopConfirmation(),
            __ -> authnBuilder.addAttribute(OAuth20Constants.DPOP_CONFIRMATION, tokenRequestContext.getDpopConfirmation()));
        return authnBuilder;
    }
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