Class HttpAuthenticator
java.lang.Object
org.apache.hc.client5.http.impl.auth.HttpAuthenticator
Utility class that implements commons aspects of the client side HTTP authentication.
- Since:
- 4.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate final org.slf4j.Loggerprivate final AuthChallengeParser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAuthResponse(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 actualAuthExchangestate and adds it to the givenHttpRequestmessage .private voidclearCache(org.apache.hc.core5.http.HttpHost host, HttpClientContext clientContext) booleanisChallenged(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.booleanupdateAuthState(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) Updates theAuthExchangestate based on the challenge presented in the response message using the givenAuthenticationStrategy.private voidupdateCache(org.apache.hc.core5.http.HttpHost host, AuthScheme authScheme, HttpClientContext clientContext)
-
Field Details
-
DEFAULT_LOGGER
private static final org.slf4j.Logger DEFAULT_LOGGER -
log
private final org.slf4j.Logger log -
parser
-
-
Constructor Details
-
HttpAuthenticator
@Internal public HttpAuthenticator(org.slf4j.Logger log) -
HttpAuthenticator
public HttpAuthenticator()
-
-
Method Details
-
isChallenged
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) Determines whether the given response represents an authentication challenge.- Parameters:
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.context- the current execution context.- Returns:
trueif the response message represents an authentication challenge,falseotherwise.
-
updateAuthState
public boolean updateAuthState(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) Updates theAuthExchangestate based on the challenge presented in the response message using the givenAuthenticationStrategy.- Parameters:
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.- Returns:
trueif the authentication state has been updated,falseif unchanged.
-
addAuthResponse
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) Generates a response to the authentication challenge based on the actualAuthExchangestate and adds it to the givenHttpRequestmessage .- Parameters:
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.
-
updateCache
private void updateCache(org.apache.hc.core5.http.HttpHost host, AuthScheme authScheme, HttpClientContext clientContext) -
clearCache
-