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);
}
use of org.apache.oltu.oauth2.common.exception.OAuthSystemException in project tesla by linking12.
the class AbstractAuthorizeHandler method responseApprovalDeny.
protected void responseApprovalDeny() throws IOException, OAuthSystemException {
final OAuthResponse oAuthResponse = OAuthASResponse.errorResponse(HttpServletResponse.SC_FOUND).setError(OAuthError.CodeResponse.ACCESS_DENIED).setErrorDescription("User denied access").location(clientDetails().getRedirectUri()).setState(oauthRequest.getState()).buildQueryMessage();
LOG.debug("'ACCESS_DENIED' response: {}", oAuthResponse);
WebUtils.writeOAuthQueryResponse(response, oAuthResponse);
final Subject subject = SecurityUtils.getSubject();
subject.logout();
LOG.debug("After 'ACCESS_DENIED' call logout. user: {}", subject.getPrincipal());
}
use of org.apache.oltu.oauth2.common.exception.OAuthSystemException in project tesla by linking12.
the class CodeAuthorizeHandler method handleResponse.
@Override
protected void handleResponse() throws OAuthSystemException, IOException {
final ClientDetails clientDetails = clientDetails();
final String authCode = oauthService.retrieveAuthCode(clientDetails);
final OAuthResponse oAuthResponse = OAuthASResponse.authorizationResponse(oauthRequest.request(), HttpServletResponse.SC_OK).location(clientDetails.getRedirectUri()).setCode(authCode).buildQueryMessage();
LOG.debug(" 'code' response: {}", oAuthResponse);
WebUtils.writeOAuthQueryResponse(response, oAuthResponse);
}
Aggregations