Search in sources :

Example 1 with OAuthTokenHandleDispatcher

use of io.github.tesla.authz.controller.oauth2.token.OAuthTokenHandleDispatcher in project tesla by linking12.

the class OauthTokenController method authorize.

@RequestMapping("token")
public void authorize(HttpServletRequest request, HttpServletResponse response) throws OAuthSystemException {
    try {
        OAuthTokenxRequest tokenRequest = new OAuthTokenxRequest(request);
        OAuthTokenHandleDispatcher tokenHandleDispatcher = new OAuthTokenHandleDispatcher(tokenRequest, response);
        tokenHandleDispatcher.dispatch();
    } catch (OAuthProblemException e) {
        LOG.debug(e.getMessage(), e);
        OAuthResponse oAuthResponse = OAuthASResponse.errorResponse(HttpServletResponse.SC_FOUND).location(e.getRedirectUri()).error(e).buildJSONMessage();
        WebUtils.writeOAuthJsonResponse(response, oAuthResponse);
    }
}
Also used : OAuthProblemException(org.apache.oltu.oauth2.common.exception.OAuthProblemException) OAuthTokenxRequest(io.github.tesla.authz.controller.oauth2.OAuthTokenxRequest) OAuthTokenHandleDispatcher(io.github.tesla.authz.controller.oauth2.token.OAuthTokenHandleDispatcher) OAuthResponse(org.apache.oltu.oauth2.common.message.OAuthResponse) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

OAuthTokenxRequest (io.github.tesla.authz.controller.oauth2.OAuthTokenxRequest)1 OAuthTokenHandleDispatcher (io.github.tesla.authz.controller.oauth2.token.OAuthTokenHandleDispatcher)1 OAuthProblemException (org.apache.oltu.oauth2.common.exception.OAuthProblemException)1 OAuthResponse (org.apache.oltu.oauth2.common.message.OAuthResponse)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1