public OAuthErrorResponse(OAuthProblemException ex) { this.error = ex.getError(); this.errorDescription = ex.getDescription(); this.errorUri = ex.getUri(); this.state = ex.getState(); }
/** * Creates invalid_request exception with given message * * @param message error message * @return OAuthException */ public static OAuthProblemException handleOAuthProblemException(String message) { return OAuthProblemException.error(OAuthError.TokenResponse.INVALID_REQUEST) .description(message); }
public static OAuthProblemException error(String error, String description) { return new OAuthProblemException(error, description); }
private void validateAccessToken(String owner, String token) throws OAuthProblemException { if (!storage.accessTokenExists(owner, token)) { throw OAuthProblemException.error("Invalid resource owner or access token"); } } }
throw new OAuthSystemException(e);
final Response.ResponseBuilder responseBuilder = Response.status(HttpServletResponse.SC_FOUND); String redirectUri = e.getRedirectUri(); e1.printStackTrace(); e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace();
httpResponse.getWriter().write(response.getBody()); } catch (OAuthSystemException e1) { e1.printStackTrace(); e.printStackTrace();
public OAuthErrorResponse(OAuthProblemException ex) { this.error = ex.getError(); this.errorDescription = ex.getDescription(); this.errorUri = ex.getUri(); this.state = ex.getState(); }
private void validateAccessToken(String owner, String token) throws OAuthProblemException { if (!storage.accessTokenExists(owner, token)) { throw OAuthProblemException.error("Invalid resource owner or access token"); } } }
/** * Creates invalid_request exception with given message * * @param message error message * @return OAuthException */ public static OAuthProblemException handleOAuthProblemException(String message) { return OAuthProblemException.error(OAuthError.TokenResponse.INVALID_REQUEST) .description(message); }
public static ResourceServer instantiateResourceServer(TokenType tokenType) throws OAuthSystemException { Class clazz = tokens.get(tokenType); if (clazz == null) { throw new OAuthSystemException("Cannot instantiate a resource server."); } return (ResourceServer)OAuthUtils.instantiateClass(clazz); }
public static OAuthProblemException error(String error) { return new OAuthProblemException(error); }
public OAuthErrorResponseBuilder error(OAuthProblemException ex) { this.parameters.put(OAuthError.OAUTH_ERROR, ex.getError()); this.parameters.put(OAuthError.OAUTH_ERROR_DESCRIPTION, ex.getDescription()); this.parameters.put(OAuthError.OAUTH_ERROR_URI, ex.getUri()); this.parameters.put(OAuth.OAUTH_STATE, ex.getState()); return this; }
protected void setBody(String body) throws OAuthProblemException { try { this.body = body; parameters = JSONUtils.parseJSON(body); } catch (Throwable e) { throw OAuthProblemException.error(OAuthError.CodeResponse.UNSUPPORTED_RESPONSE_TYPE, "Invalid response! Response body is not " + OAuth.ContentType.JSON + " encoded"); } }
private AuthenticatedUser getAuthenticatedUser(String accessToken) throws OAuthSystemException { AccessTokenDO accessTokenDO; try { accessTokenDO = OAuth2Util.getAccessTokenDOfromTokenIdentifier(accessToken); return OAuth2Util.getAuthenticatedUser(accessTokenDO); } catch (IdentityOAuth2Exception e) { throw new OAuthSystemException(); } }
public static OAuthProblemException error(String error, String description) { return new OAuthProblemException(error, description); }
public OAuthErrorResponseBuilder error(OAuthProblemException ex) { this.parameters.put(OAuthError.OAUTH_ERROR, ex.getError()); this.parameters.put(OAuthError.OAUTH_ERROR_DESCRIPTION, ex.getDescription()); this.parameters.put(OAuthError.OAUTH_ERROR_URI, ex.getUri()); this.parameters.put(OAuth.OAUTH_STATE, ex.getState()); return this; }
protected void setBody(String body) throws OAuthProblemException { try { this.body = body; parameters = JSONUtils.parseJSON(body); } catch (Throwable e) { throw OAuthProblemException.error(OAuthError.CodeResponse.UNSUPPORTED_RESPONSE_TYPE, "Invalid response! Response body is not application/json encoded"); } }
public static OAuthProblemException error(String error) { return new OAuthProblemException(error); }
protected void setBody(String body) throws OAuthProblemException { try { this.body = body; parameters = JSONUtils.parseJSON(body); } catch (Throwable e) { throw OAuthProblemException.error(OAuthError.CodeResponse.UNSUPPORTED_RESPONSE_TYPE, "Invalid response! Response body is not " + OAuth.ContentType.JSON + " encoded"); } }