Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.commons.httpclient.auth.HttpAuthenticator
public final class HttpAuthenticator
extends java.lang.Object
A client SHOULD assume that all paths at or deeper than the depth of the last symbolic element in the path field of the Request-URI also are within the protection space specified by the basic realm value of the current challenge. A client MAY preemptively send the corresponding Authorization header with requests for resources in that space without receipt of another challenge from the server. Similarly, when a client sends a request to a proxy, it may reuse a userid and password in the Proxy-Authorization header field without receiving another challenge from the proxy server.
Field Summary | |
static String |
|
static String |
|
static String |
|
static String |
|
Method Summary | |
static boolean |
|
static boolean |
|
static boolean |
|
static boolean |
|
static AuthScheme |
|
public static final String PROXY_AUTH
The proxy authenticate challange header.
public static final String PROXY_AUTH_RESP
The proxy authenticate response header.
public static final String WWW_AUTH
The www authenticate challange header.
public static final String WWW_AUTH_RESP
The www authenticate response header.
public static boolean authenticate(AuthScheme authscheme, HttpMethod method, HttpConnection conn, HttpState state) throws AuthenticationException
Deprecated. use AuthScheme
Attempt to provide requisite authentication credentials to the given method in the given context using the given authentication scheme.
- Parameters:
authscheme
- The authentication scheme to be usedmethod
- The HttpMethod which requires authenticationconn
- the connection to a specific host. This parameter may be null if default credentials (not specific to any particular host) are to be usedstate
- The HttpState object providing Credentials
- Returns:
- true if the Authenticate response header was added
- Throws:
AuthenticationException
- when a parsing or other error occurs
public static boolean authenticateDefault(HttpMethod method, HttpConnection conn, HttpState state) throws AuthenticationException
Deprecated. use AuthScheme
Attempt to provide default authentication credentials to the given method in the given context using basic authentication scheme.
- Parameters:
method
- the HttpMethod which requires authenticationconn
- the connection to a specific host. This parameter may be null if default credentials (not specific to any particular host) are to be usedstate
- the HttpState object providing Credentials
- Returns:
- true if the Authenticate response header was added
- Throws:
AuthenticationException
- when a parsing or other error occurs
public static boolean authenticateProxy(AuthScheme authscheme, HttpMethod method, HttpConnection conn, HttpState state) throws AuthenticationException
Deprecated. use AuthScheme
Attempt to provide requisite proxy authentication credentials to the given method in the given context using the given authentication scheme.
- Parameters:
authscheme
- The authentication scheme to be usedmethod
- the HttpMethod which requires authenticationconn
- the connection to a specific host. This parameter may be null if default credentials (not specific to any particular host) are to be usedstate
- the HttpState object providing Credentials
- Returns:
- true if the Proxy-Authenticate response header was added
- Throws:
AuthenticationException
- when a parsing or other error occurs
public static boolean authenticateProxyDefault(HttpMethod method, HttpConnection conn, HttpState state) throws AuthenticationException
Deprecated. use AuthScheme
Attempt to provide default proxy authentication credentials to the given method in the given context using basic authentication scheme.
- Parameters:
method
- the HttpMethod which requires authenticationconn
- the connection to a specific host. This parameter may be null if default credentials (not specific to any particular host) are to be usedstate
- the HttpState object providing Credentials
- Returns:
- true if the Proxy-Authenticate response header was added
- Throws:
AuthenticationException
- when a parsing or other error occurs
public static AuthScheme selectAuthScheme(Header[] challenges) throws MalformedChallengeException
Deprecated. Use
AuthChallengeParser.parseChallenges(Header[])
andAuthPolicy.getAuthScheme(String)
Chooses the strongest authentication scheme supported from the array of authentication challenges. Currently onlyNTLM
,Digest
,Basic
schemes are recognized. TheNTLM
scheme is considered the strongest and is preferred to all others. TheDigest
scheme is preferred to theBasic
one which provides no encryption for credentials. TheBasic
scheme is used only if it is the only one supported.
- Parameters:
challenges
- The array of authentication challenges
- Returns:
- The strongest authentication scheme supported
- Throws:
MalformedChallengeException
- is thrown if an authentication challenge is malformed