List of usage examples for org.apache.http.auth AuthProtocolState equals
public boolean equals(Object obj)
From source file:com.joyent.http.signature.apache.httpclient.HttpSignatureAuthenticationStrategy.java
/** * Determines if the given HTTP response response represents * an authentication challenge that was sent back as a result * of authentication failure.//www . j av a2 s .c o m * * @param authHost authentication host. * @param response HTTP response. * @param context HTTP context. * @return {@code true} if user authentication is required, * {@code false} otherwise. */ @Override public boolean isAuthenticationRequested(final HttpHost authHost, final HttpResponse response, final HttpContext context) { final StatusLine line = response.getStatusLine(); final int code = line.getStatusCode(); final HttpClientContext clientContext = HttpClientContext.adapt(context); final AuthState authState = clientContext.getTargetAuthState(); final AuthProtocolState authProtocolState = authState.getState(); if (code == HttpStatus.SC_UNAUTHORIZED) { if (authProtocolState.equals(AuthProtocolState.CHALLENGED)) { clientContext.getTargetAuthState().setState(AuthProtocolState.FAILURE); authFailed(authHost, authState.getAuthScheme(), context); } return true; } if (clientContext.getTargetAuthState() == null) { return true; } return false; }