ntcredentials = (NTCredentials) credentials; } catch (ClassCastException e) { throw new InvalidCredentialsException( "Credentials cannot be used for NTLM authentication: " + credentials.getClass().getName());
/** * This intializes a new jersey restclient for http call with elasticenter */ public static ElastiCenterClient getElastistorRestClient() { ElastiCenterClient restclient = null; try { String ip = getConfigurationDao().getValue("cloudbyte.management.ip"); String apikey = getConfigurationDao().getValue("cloudbyte.management.apikey"); if (ip == null) { throw new CloudRuntimeException("set the value of cloudbyte.management.ip in global settings"); } if (apikey == null) { throw new CloudRuntimeException("set the value of cloudbyte.management.apikey in global settings"); } restclient = new ElastiCenterClient(ip, apikey); } catch (InvalidCredentialsException e) { throw new CloudRuntimeException("InvalidCredentialsException:" + e.getMessage(), e); } catch (InvalidParameterException e) { throw new CloudRuntimeException("InvalidParameterException:" + e.getMessage(), e); } catch (SSLHandshakeException e) { throw new CloudRuntimeException("SSLHandshakeException:" + e.getMessage(), e); } catch (ServiceUnavailableException e) { throw new CloudRuntimeException("ServiceUnavailableException:" + e.getMessage(), e); } return restclient; }
System.out.println("ElastiCenter returned error code : " + response.getStatus()); if (401 == response.getStatus()) { throw new InvalidCredentialsException("Please specify a valid API Key."); } else if (431 == response.getStatus()) { throw new InvalidParameterException(response.getHeaders().getFirst("X-Description"));
/** * Produces JWT authorization header for the given set of {@link Credentials}. * * @param credentials * The set of credentials to be used for authentication * @param request * The request being authenticated * @throws org.apache.http.auth.InvalidCredentialsException * if authentication credentials are not valid or not applicable for this authentication scheme * @throws AuthenticationException * if authorization string cannot be generated due to an authentication failure * * @return a JWT authorization string */ @Override public Header authenticate(final Credentials credentials, final HttpRequest request, final HttpContext context) throws AuthenticationException { Args.notNull(credentials, "Credentials"); Args.notNull(request, "HTTP request"); if (credentials instanceof JwtCredentials) { return new BasicHeader(AUTH.WWW_AUTH_RESP, "Bearer " + ((JwtCredentials) credentials).getToken()); } else { throw new InvalidCredentialsException( "Credentials cannot be used for JWT authentication: " + credentials.getClass().getName()); } }
throw new InvalidCredentialsException(method.getStatusText());
if (gsse.getMajor() == GSSException.DEFECTIVE_CREDENTIAL || gsse.getMajor() == GSSException.CREDENTIALS_EXPIRED) throw new InvalidCredentialsException(gsse.getMessage(), gsse); if (gsse.getMajor() == GSSException.NO_CRED) throw new InvalidCredentialsException(gsse.getMessage(), gsse); if (gsse.getMajor() == GSSException.DEFECTIVE_TOKEN || gsse.getMajor() == GSSException.DUPLICATE_TOKEN
throw new InvalidCredentialsException( "Unsupported authentication scheme: " + scope.getScheme());
throw new InvalidCredentialsException( "Unsupported authentication scheme: " + scope.getScheme());
state = State.FAILED; if (gsse.getMajor() == GSSException.DEFECTIVE_CREDENTIAL || gsse.getMajor() == GSSException.CREDENTIALS_EXPIRED) throw new InvalidCredentialsException(gsse.getMessage(), gsse); if (gsse.getMajor() == GSSException.NO_CRED) throw new InvalidCredentialsException(gsse.getMessage(), gsse); if (gsse.getMajor() == GSSException.DEFECTIVE_TOKEN || gsse.getMajor() == GSSException.DUPLICATE_TOKEN || gsse.getMajor() == GSSException.OLD_TOKEN)
if (gsse.getMajor() == GSSException.DEFECTIVE_CREDENTIAL || gsse.getMajor() == GSSException.CREDENTIALS_EXPIRED) { throw new InvalidCredentialsException(gsse.getMessage(), gsse); throw new InvalidCredentialsException(gsse.getMessage(), gsse);
if (gsse.getMajor() == GSSException.DEFECTIVE_CREDENTIAL || gsse.getMajor() == GSSException.CREDENTIALS_EXPIRED) { throw new InvalidCredentialsException(gsse.getMessage(), gsse); throw new InvalidCredentialsException(gsse.getMessage(), gsse);
if (gsse.getMajor() == GSSException.DEFECTIVE_CREDENTIAL || gsse.getMajor() == GSSException.CREDENTIALS_EXPIRED) { throw new InvalidCredentialsException(gsse.getMessage(), gsse); throw new InvalidCredentialsException(gsse.getMessage(), gsse);
if (gsse.getMajor() == GSSException.DEFECTIVE_CREDENTIAL || gsse.getMajor() == GSSException.CREDENTIALS_EXPIRED) { throw new InvalidCredentialsException(gsse.getMessage(), gsse); throw new InvalidCredentialsException(gsse.getMessage(), gsse);
if (gsse.getMajor() == GSSException.DEFECTIVE_CREDENTIAL || gsse.getMajor() == GSSException.CREDENTIALS_EXPIRED) { throw new InvalidCredentialsException(gsse.getMessage(), gsse); throw new InvalidCredentialsException(gsse.getMessage(), gsse);
if (gsse.getMajor() == GSSException.DEFECTIVE_CREDENTIAL || gsse.getMajor() == GSSException.CREDENTIALS_EXPIRED) { throw new InvalidCredentialsException(gsse.getMessage(), gsse); throw new InvalidCredentialsException(gsse.getMessage(), gsse);
ntcredentials = (NTCredentials) credentials; } catch (ClassCastException e) { throw new InvalidCredentialsException( "Credentials cannot be used for NTLM authentication: " + credentials.getClass().getName());
ntcredentials = (NTCredentials) credentials; } catch (ClassCastException e) { throw new InvalidCredentialsException( "Credentials cannot be used for NTLM authentication: " + credentials.getClass().getName());
ntcredentials = (NTCredentials) credentials; } catch (ClassCastException e) { throw new InvalidCredentialsException( "Credentials cannot be used for NTLM authentication: " + credentials.getClass().getName());
throw new InvalidCredentialsException( "Credentials cannot be used for " + getSchemeName() + " authentication: " + credentials.getClass().getName());
ntcredentials = (NTCredentials) credentials; } catch (final ClassCastException e) { throw new InvalidCredentialsException( "Credentials cannot be used for NTLM authentication: " + credentials.getClass().getName());