java.lang.Object
net.i2p.util.EepGet.AuthState
- Enclosing class:
EepGet
Manage the authentication parameters Ref: RFC 2617 Supports both Basic and Digest, however i2ptunnel HTTP proxy has migrated all previous Basic support to Digest.
Field Summary
Modifier and TypeFieldDescriptionParameters parsed from the auth challenge.private StringThe authentication challenge received in the 407 response, after the mode string.Auth mode as received in the 407 response.booleanWhether the auth header has been sent.private StringClient nonce sent in the digest response.private intNonce count sent in the digest response.private final StringThe proxy password.private final StringThe proxy user name.Constructor Summary
Method Summary
All MethodsModifier and TypeMethodDescriptiongenerateAuthArgs(String method, String uri) Generate the digest authentication parameters Ref: RFC 2617.getAuthHeader(String method, String uri) Build the Authorization header for the given request.Get the password these credentials were built with.Get the username these credentials were built with, as supplied toAuthState(String, String)or the -u command line option.voidsetAuthChallenge(String auth) May be called multiple times, save the best one.
Field Details
username
The proxy user name.password
The proxy password.authMode
Auth mode as received in the 407 response.authChallenge
The authentication challenge received in the 407 response, after the mode string.authSent
public boolean authSentWhether the auth header has been sent.nonceCount
private int nonceCountNonce count sent in the digest response.cnonce
Client nonce sent in the digest response.args
Constructor Details
AuthState
Method Details
setAuthChallenge
May be called multiple times, save the best one.- Parameters:
auth- challenge string from 407 response
getAuthHeader
Build the Authorization header for the given request.- Parameters:
method- the HTTP method of the request being authorizeduri- the request target, needed for the digest A2 hash- Returns:
- the auth header
- Throws:
IOException- if the digest challenge is missing or unusable, or if the proxy asked for an authentication mode this client does not implement
generateAuthArgs
Generate the digest authentication parameters Ref: RFC 2617.- Parameters:
method- the HTTP method of the request being authorizeduri- the request target, hashed into the A2 value- Returns:
- the digest parameter names mapped to their already-quoted values
- Throws:
IOException- if the challenge carried no realm or no nonce
getUsername
Get the username these credentials were built with, as supplied toAuthState(String, String)or the -u command line option.- Returns:
- the username the proxy credentials were parsed from
getPassword
Get the password these credentials were built with. It is retained in clear here because the digest response has to be recomputed on every 407 challenge, and is never written to the log.- Returns:
- the password the proxy credentials were parsed from