private static ModelAndView handleAccessTokenException(final Throwable exception, final HttpServletResponse response) {
        val data = ACCESS_TOKEN_RESPONSE_EXCEPTIONS.getOrDefault(exception.getClass().getName(),
            new AccessTokenExceptionResponses(OAuth20Constants.INVALID_GRANT, "Invalid or unauthorized grant"));
        LoggingUtils.error(LOGGER, String.format("%s: %s", data.message(), exception.getMessage()), exception);
        return OAuth20Utils.writeError(response, data.code(), data.message());
    }
This controller returns an access token according to the given
OAuth code and client credentials (authorization code grant type)
or according to the refresh token and client credentials
(refresh token grant type) or according to the user identity
(resource owner password grant type).

@author Jerome Leleu
@since 3.5.0
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/endpoints/OAuth20AccessTokenEndpointController.java