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);
}
use of org.apache.oltu.oauth2.common.exception.OAuthSystemException in project tesla by linking12.
the class AbstractOAuthTokenHandler method validateFailed.
protected boolean validateFailed() throws OAuthSystemException {
AbstractClientDetailsValidator validator = getValidator();
LOG.debug("Use [{}] validate client: {}", validator, tokenRequest.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 ClientCredentialsTokenHandler method handleAfterValidation.
@Override
public void handleAfterValidation() throws OAuthProblemException, OAuthSystemException {
AccessToken accessToken = oauthService.retrieveClientCredentialsAccessToken(clientDetails(), tokenRequest.getScopes());
final OAuthResponse tokenResponse = createTokenResponse(accessToken, false);
LOG.debug("'client_credentials' response: {}", tokenResponse);
WebUtils.writeOAuthJsonResponse(response, tokenResponse);
}
use of org.apache.oltu.oauth2.common.exception.OAuthSystemException in project tesla by linking12.
the class PasswordTokenHandler method handleAfterValidation.
@Override
public void handleAfterValidation() throws OAuthProblemException, OAuthSystemException {
AccessToken accessToken = oauthService.retrievePasswordAccessToken(clientDetails(), tokenRequest.getScopes(), tokenRequest.getUsername());
final OAuthResponse tokenResponse = createTokenResponse(accessToken, false);
LOG.debug("'password' response: {}", tokenResponse);
WebUtils.writeOAuthJsonResponse(response, tokenResponse);
}
Aggregations