Methods Summary |
---|
public org.apache.http.Header | authenticate(org.apache.http.auth.Credentials credentials, org.apache.http.HttpRequest request)Produces basic authorization header for the given set of {@link Credentials}.
if (credentials == null) {
throw new IllegalArgumentException("Credentials may not be null");
}
if (request == null) {
throw new IllegalArgumentException("HTTP request may not be null");
}
String charset = AuthParams.getCredentialCharset(request.getParams());
return authenticate(credentials, charset, isProxy());
|
public static org.apache.http.Header | authenticate(org.apache.http.auth.Credentials credentials, java.lang.String charset, boolean proxy)Returns a basic Authorization header value for the given
{@link Credentials} and charset.
if (credentials == null) {
throw new IllegalArgumentException("Credentials may not be null");
}
if (charset == null) {
throw new IllegalArgumentException("charset may not be null");
}
StringBuilder tmp = new StringBuilder();
tmp.append(credentials.getUserPrincipal().getName());
tmp.append(":");
tmp.append((credentials.getPassword() == null) ? "null" : credentials.getPassword());
byte[] base64password = Base64.encodeBase64(
EncodingUtils.getBytes(tmp.toString(), charset));
CharArrayBuffer buffer = new CharArrayBuffer(32);
if (proxy) {
buffer.append(AUTH.PROXY_AUTH_RESP);
} else {
buffer.append(AUTH.WWW_AUTH_RESP);
}
buffer.append(": Basic ");
buffer.append(base64password, 0, base64password.length);
return new BufferedHeader(buffer);
|
public java.lang.String | getSchemeName()Returns textual designation of the basic authentication scheme.
return "basic";
|
public boolean | isComplete()Tests if the Basic authentication process has been completed.
return this.complete;
|
public boolean | isConnectionBased()Returns false. Basic authentication scheme is request based.
return false;
|
public void | processChallenge(org.apache.http.Header header)Processes the Basic challenge.
super.processChallenge(header);
this.complete = true;
|