@Internal @Contract(threading=STATELESS) public class AuthenticationHandler extends Object
Constructor and Description |
---|
AuthenticationHandler() |
Modifier and Type | Method and Description |
---|---|
void |
addAuthResponse(org.apache.hc.core5.http.HttpHost host,
ChallengeType challengeType,
org.apache.hc.core5.http.HttpRequest request,
AuthExchange authExchange,
org.apache.hc.core5.http.protocol.HttpContext context)
Generates a response to the authentication challenge based on the actual
AuthExchange state
and adds it to the given HttpRequest message . |
Map<String,AuthChallenge> |
extractChallengeMap(ChallengeType challengeType,
org.apache.hc.core5.http.HttpResponse response,
HttpClientContext context) |
boolean |
handleResponse(org.apache.hc.core5.http.HttpHost host,
ChallengeType challengeType,
org.apache.hc.core5.http.HttpResponse response,
AuthenticationStrategy authStrategy,
AuthExchange authExchange,
org.apache.hc.core5.http.protocol.HttpContext context)
Handles the response from the opposite endpoint and updates the
AuthExchange
state based on the challenge presented in the response message using the given
AuthenticationStrategy . |
boolean |
isChallenged(org.apache.hc.core5.http.HttpHost host,
ChallengeType challengeType,
org.apache.hc.core5.http.HttpResponse response,
AuthExchange authExchange,
org.apache.hc.core5.http.protocol.HttpContext context)
Determines whether the given response represents an authentication challenge, and updates
the
AuthExchange state. |
boolean |
isChallengeExpected(AuthExchange authExchange)
Determines if the scheme requires an auth challenge for responses that do not
have a challenge HTTP code.
|
public boolean isChallenged(org.apache.hc.core5.http.HttpHost host, ChallengeType challengeType, org.apache.hc.core5.http.HttpResponse response, AuthExchange authExchange, org.apache.hc.core5.http.protocol.HttpContext context)
AuthExchange
state.host
- the hostname of the opposite endpoint.challengeType
- the challenge type (target or proxy).response
- the response message head.authExchange
- the current authentication exchange state. Gets updated.context
- the current execution context.true
if the response message represents an authentication challenge,
false
otherwise.public boolean isChallengeExpected(AuthExchange authExchange)
public Map<String,AuthChallenge> extractChallengeMap(ChallengeType challengeType, org.apache.hc.core5.http.HttpResponse response, HttpClientContext context)
public boolean handleResponse(org.apache.hc.core5.http.HttpHost host, ChallengeType challengeType, org.apache.hc.core5.http.HttpResponse response, AuthenticationStrategy authStrategy, AuthExchange authExchange, org.apache.hc.core5.http.protocol.HttpContext context) throws AuthenticationException, MalformedChallengeException
AuthExchange
state based on the challenge presented in the response message using the given
AuthenticationStrategy
.host
- the hostname of the opposite endpoint.challengeType
- the challenge type (target or proxy).response
- the response message head.authStrategy
- the authentication strategy.authExchange
- the current authentication exchange state.context
- the current execution context.true
if the request needs-to be re-sent,
false
if the authentication is complete (successful or not).AuthenticationException
- if the AuthScheme throws one. In most cases this indicates a
client side problem, as final server error responses are simply returned.MalformedChallengeException
- if the AuthScheme throws one. In most cases this indicates a
client side problem, as final server error responses are simply returned.public void addAuthResponse(org.apache.hc.core5.http.HttpHost host, ChallengeType challengeType, org.apache.hc.core5.http.HttpRequest request, AuthExchange authExchange, org.apache.hc.core5.http.protocol.HttpContext context)
AuthExchange
state
and adds it to the given HttpRequest
message .host
- the hostname of the opposite endpoint.challengeType
- the challenge type (target or proxy).request
- the request message head.authExchange
- the current authentication exchange state.context
- the current execution context.Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.