use of org.apache.oltu.oauth2.common.exception.OAuthSystemException in project tesla by linking12.
the class AuthorizationCodeTokenHandler method responseToken.
private void responseToken() throws OAuthSystemException {
AccessToken accessToken = oauthService.retrieveAuthorizationCodeAccessToken(clientDetails(), tokenRequest.getCode());
final OAuthResponse tokenResponse = createTokenResponse(accessToken, false);
LOG.debug("'authorization_code' response: {}", tokenResponse);
WebUtils.writeOAuthJsonResponse(response, tokenResponse);
}
use of org.apache.oltu.oauth2.common.exception.OAuthSystemException in project tesla by linking12.
the class RefreshTokenHandler method handleAfterValidation.
@Override
public void handleAfterValidation() throws OAuthProblemException, OAuthSystemException {
final String refreshToken = tokenRequest.getRefreshToken();
AccessToken accessToken = oauthService.changeAccessTokenByRefreshToken(refreshToken, tokenRequest.getClientId());
final OAuthResponse tokenResponse = createTokenResponse(accessToken, false);
LOG.debug("'refresh_token' response: {}", tokenResponse);
WebUtils.writeOAuthJsonResponse(response, tokenResponse);
}
use of org.apache.oltu.oauth2.common.exception.OAuthSystemException in project tesla by linking12.
the class OauthAuthorizeController method unsupportResponseType.
private void unsupportResponseType(OAuthAuthxRequest oauthRequest, HttpServletResponse response) throws OAuthSystemException {
final String responseType = oauthRequest.getResponseType();
LOG.debug("Unsupport response_type '{}' by client_id '{}'", responseType, oauthRequest.getClientId());
OAuthResponse oAuthResponse = OAuthResponse.errorResponse(HttpServletResponse.SC_BAD_REQUEST).setError(OAuthError.CodeResponse.UNSUPPORTED_RESPONSE_TYPE).setErrorDescription("Unsupport response_type '" + responseType + "'").buildJSONMessage();
WebUtils.writeOAuthJsonResponse(response, oAuthResponse);
}
use of org.apache.oltu.oauth2.common.exception.OAuthSystemException 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);
}
}
use of org.apache.oltu.oauth2.common.exception.OAuthSystemException in project tesla by linking12.
the class AbstractAuthorizeHandler method validateFailed.
protected boolean validateFailed() throws OAuthSystemException {
AbstractClientDetailsValidator validator = getValidator();
LOG.debug("Use [{}] validate client: {}", validator, oauthRequest.getClientId());
final OAuthResponse oAuthResponse = validator.validate();
return checkAndResponseValidateFailed(oAuthResponse);
}
Aggregations