public class AuthorizationChallengeHandler extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
AUTHENTICATION_INFO
Header representing additional information a server is expecting during future authentication requests.
|
static String |
AUTHORIZATION
Header representing the authorization the client is presenting to a server.
|
static String |
PROXY_AUTHENTICATE
Header representing a proxy server requesting authentication.
|
static String |
PROXY_AUTHENTICATION_INFO
Header representing additional information a proxy server is expecting during future authentication requests.
|
static String |
PROXY_AUTHORIZATION
Header representing the authorization the client is presenting to a proxy server.
|
static String |
WWW_AUTHENTICATE
Header representing a server requesting authentication.
|
| Constructor and Description |
|---|
AuthorizationChallengeHandler(String username,
String password)
Creates an
AuthorizationChallengeHandler using the username and password to respond to
authentication challenges. |
| Modifier and Type | Method and Description |
|---|---|
String |
attemptToPipelineAuthorization(String method,
String uri,
Supplier<byte[]> entityBodySupplier)
Attempts to pipeline requests by applying the most recent authorization type used to create an authorization
header.
|
void |
consumeAuthenticationInfoHeader(Map<String,String> authenticationInfoMap)
Consumes either the 'Authentication-Info' or 'Proxy-Authentication-Info' header returned in a response from a
server.
|
String |
handleBasic()
Handles Basic authentication challenges.
|
String |
handleDigest(String method,
String uri,
List<Map<String,String>> challenges,
Supplier<byte[]> entityBodySupplier)
Handles Digest authentication challenges.
|
static Map<String,String> |
parseAuthenticationOrAuthorizationHeader(String header)
Parses the
Authorization or Authentication header into its key-value pairs. |
public static final String WWW_AUTHENTICATE
public static final String PROXY_AUTHENTICATE
public static final String AUTHORIZATION
public static final String PROXY_AUTHORIZATION
public static final String AUTHENTICATION_INFO
public static final String PROXY_AUTHENTICATION_INFO
public AuthorizationChallengeHandler(String username, String password)
AuthorizationChallengeHandler using the username and password to respond to
authentication challenges.username - Username used to response to authorization challenges.password - Password used to respond to authorization challenges.NullPointerException - If username or password are null.public final String handleBasic()
public final String handleDigest(String method, String uri, List<Map<String,String>> challenges, Supplier<byte[]> entityBodySupplier)
method - HTTP method being used in the request.uri - Relative URI for the request.challenges - List of challenges that the server returned for the client to choose from and use when creating
the authorization header.entityBodySupplier - Supplies the request entity body, used to compute the hash of the body when using
"qop=auth-int".public final String attemptToPipelineAuthorization(String method, String uri, Supplier<byte[]> entityBodySupplier)
method - HTTP method being used in the request.uri - Relative URI for the request.entityBodySupplier - Supplies the request entity body, used to compute the hash of the body when using
"qop=auth-int".public final void consumeAuthenticationInfoHeader(Map<String,String> authenticationInfoMap)
See RFC 7615 for more information about these headers.
authenticationInfoMap - Either 'Authentication-Info' or 'Proxy-Authentication-Info' header returned from the
server split into its key-value pair pieces.public static Map<String,String> parseAuthenticationOrAuthorizationHeader(String header)
Authorization or Authentication header into its key-value pairs.
This will remove quotes on quoted string values.
header - Authorization or Authentication header.Copyright © 2020 Microsoft Corporation. All rights reserved.