List of usage examples for org.springframework.security.oauth2.client.resource OAuth2AccessDeniedException getOAuth2ErrorCode
@Override
public String getOAuth2ErrorCode()
From source file:org.eclipse.cft.server.core.internal.CloudErrorUtil.java
/** * Error due to invalid credentials, typically 401 or 403 HTTP errors. * Returns null if the error is NOT an invalid credentials error. * @param error error to parse//from w ww . j a va 2 s.c o m * @return Error message if invalid credentials error (401 or 403), or null. */ public static String getInvalidCredentialsError(Throwable error) { if (isUnauthorisedException(error)) { return Messages.ERROR_WRONG_EMAIL_OR_PASSWORD_UNAUTHORISED; } else if (isForbiddenException(error)) { return Messages.ERROR_WRONG_EMAIL_OR_PASSWORD_FORBIDDEN; } else { OAuth2AccessDeniedException oauthException = null; if (error instanceof OAuth2AccessDeniedException) { oauthException = (OAuth2AccessDeniedException) error; } else if (error.getCause() instanceof OAuth2AccessDeniedException) { oauthException = (OAuth2AccessDeniedException) error.getCause(); } if (oauthException != null) { return NLS.bind(Messages.ERROR_ACCESS_TOKEN, oauthException.getOAuth2ErrorCode()); } } return null; }