public final class HttpAuthenticator extends 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.
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
PROXY_AUTH
已过时。
The proxy authenticate challange header.
|
static String |
PROXY_AUTH_RESP
已过时。
The proxy authenticate response header.
|
static String |
WWW_AUTH
已过时。
The www authenticate challange header.
|
static String |
WWW_AUTH_RESP
已过时。
The www authenticate response header.
|
| 构造器和说明 |
|---|
HttpAuthenticator()
已过时。
|
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
authenticate(AuthScheme authscheme,
HttpMethod method,
HttpConnection conn,
HttpState state)
已过时。
use AuthScheme
|
static boolean |
authenticateDefault(HttpMethod method,
HttpConnection conn,
HttpState state)
已过时。
use AuthScheme
|
static boolean |
authenticateProxy(AuthScheme authscheme,
HttpMethod method,
HttpConnection conn,
HttpState state)
已过时。
use AuthScheme
|
static boolean |
authenticateProxyDefault(HttpMethod method,
HttpConnection conn,
HttpState state)
已过时。
use AuthScheme
|
static AuthScheme |
selectAuthScheme(Header[] challenges)
|
public static final String WWW_AUTH
public static final String WWW_AUTH_RESP
public static final String PROXY_AUTH
public static AuthScheme selectAuthScheme(Header[] challenges) throws MalformedChallengeException
NTLM,
Digest, Basic schemes are recognized.
The NTLM scheme is considered the strongest and is
preferred to all others. The Digest scheme is preferred to
the Basic one which provides no encryption for credentials.
The Basic scheme is used only if it is the only one
supported.challenges - The array of authentication challengesMalformedChallengeException - is thrown if an authentication
challenge is malformedUnsupportedOperationException - when none of challenge types
available is supported.public static boolean authenticateDefault(HttpMethod method, HttpConnection conn, HttpState state) throws AuthenticationException
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 CredentialsInvalidCredentialsException - if authentication credentials
are not valid or not applicable for basic schemeAuthenticationException - when a parsing or other error occursHttpState.setCredentials(String,String,Credentials)public static boolean authenticateProxyDefault(HttpMethod method, HttpConnection conn, HttpState state) throws AuthenticationException
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 CredentialsInvalidCredentialsException - if authentication credentials
are not valid or not applicable for basic schemeAuthenticationException - when a parsing or other error occursHttpState.setCredentials(String,String,Credentials)public static boolean authenticate(AuthScheme authscheme, HttpMethod method, HttpConnection conn, HttpState state) throws AuthenticationException
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 CredentialsCredentialsNotAvailableException - if authentication credentials
required to respond to the authentication challenge are not availableAuthenticationException - when a parsing or other error occursHttpState.setCredentials(String,String,Credentials)public static boolean authenticateProxy(AuthScheme authscheme, HttpMethod method, HttpConnection conn, HttpState state) throws AuthenticationException
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 CredentialsCredentialsNotAvailableException - if authentication credentials
required to respond to the authentication challenge are not availableAuthenticationException - when a parsing or other error occursHttpState.setCredentials(String,String,Credentials)Copyright © 2017. All rights reserved.