protected Map<String, Object> getAccessTokenResponseModel(final OAuth20AccessTokenResponseResult result) {
        val model = new LinkedHashMap<String, Object>();
        val generatedToken = result.getGeneratedToken();
        generatedToken.getAccessToken()
            .ifPresent(token -> {
                val accessToken = resolveToken(token, OAuth20AccessToken.class);
                if (result.getResponseType() != OAuth20ResponseTypes.ID_TOKEN && accessToken.getExpiresIn() > 0) {
                    val encodedAccessTokenId = encodeOAuthToken(accessToken, result);
                    if (StringUtils.equals(encodedAccessTokenId, accessToken.getId()) && token.isStateless()) {
                        model.put(OAuth20Constants.ACCESS_TOKEN, token.getId());
                    } else {
                        model.put(OAuth20Constants.ACCESS_TOKEN, encodedAccessTokenId);
                    }

                    if (!accessToken.getScopes().isEmpty()) {
                        model.put(OAuth20Constants.SCOPE, String.join(" ", accessToken.getScopes()));
                    }
                    model.put(OAuth20Constants.EXPIRES_IN, accessToken.getExpiresIn());
                    val authentication = accessToken.getAuthentication();
                    model.put(OAuth20Constants.TOKEN_TYPE, authentication.containsAttribute(OAuth20Constants.DPOP_CONFIRMATION)
                        ? OAuth20Constants.TOKEN_TYPE_DPOP : OAuth20Constants.TOKEN_TYPE_BEARER);
                    if (result.getUserProfile() != null) {
                        result.getUserProfile().addAttribute(Principal.class.getName(), authentication.getPrincipal());
                    }
                    if (result.getGrantType() == OAuth20GrantTypes.TOKEN_EXCHANGE) {
                        model.put(OAuth20Constants.ISSUED_TOKEN_TYPE, result.getRequestedTokenType().getType());
                    }
                }
            });
        generatedToken.getRefreshToken().ifPresent(ticket -> {
            val refreshToken = resolveToken(ticket, OAuth20RefreshToken.class);
            val encodedRefreshToken = encodeOAuthToken(refreshToken, result);

            if (StringUtils.equals(encodedRefreshToken, refreshToken.getId()) && ticket.isStateless()) {
                model.put(OAuth20Constants.REFRESH_TOKEN, ticket.getId());
            } else {
                model.put(OAuth20Constants.REFRESH_TOKEN, encodedRefreshToken);
            }
        });
        return model;
    }
This is {@link OAuth20DefaultAccessTokenResponseGenerator}.

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