Top Description Fields Constructors Methods
org.apache.hc.client5.http.impl

public Class DefaultUserTokenHandler

extends Object
implements UserTokenHandler
Class Inheritance
All Implemented Interfaces
org.apache.hc.client5.http.UserTokenHandler
Annotations
@Contract
threading:STATELESS
Imports
java.security.Principal, javax.net.ssl.SSLSession, org.apache.hc.client5.http.HttpRoute, .UserTokenHandler, org.apache.hc.client5.http.auth.AuthExchange, .AuthScheme, org.apache.hc.client5.http.protocol.HttpClientContext, org.apache.hc.core5.annotation.Contract, .ThreadingBehavior, org.apache.hc.core5.http.HttpHost, .HttpRequest, org.apache.hc.core5.http.protocol.HttpContext

Default implementation of UserTokenHandler. This class will use an instance of Principal as a state object for HTTP connections, if it can be obtained from the given execution context. This helps ensure persistent connections created with a particular user identity within a particular security context can be reused by the same user only.

DefaultUserTokenHandler will use the user principal of connection based authentication schemes such as NTLM or that of the SSL session with the client authentication turned on. If both are unavailable, null token will be returned.

Since
4.0

Field Summary

Modifier and TypeField and Description
public static final DefaultUserTokenHandler

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static Principal
getAuthPrincipal(final AuthExchange authExchange)

public Object
getUserToken(final HttpRoute
HTTP route
route
,
final HttpContext
the execution context
context
)

Implements org.apache.hc.client5.http.UserTokenHandler.getUserToken.

The token object returned by this method is expected to uniquely identify the current user if the context is user specific or to be null if it is not.
public Object
getUserToken(final HttpRoute
HTTP route
route
,
final HttpRequest
HTTP request
request
,
final HttpContext
the execution context
context
)

Overrides default org.apache.hc.client5.http.UserTokenHandler.getUserToken.

The token object returned by this method is expected to uniquely identify the current user if the context is user specific or to be null if it is not.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
public static final DefaultUserTokenHandler INSTANCE

Constructor Detail

DefaultUserTokenHandlerback to summary
public DefaultUserTokenHandler()

Method Detail

getAuthPrincipalback to summary
private static Principal getAuthPrincipal(final AuthExchange authExchange)
getUserTokenback to summary
public Object getUserToken(final HttpRoute route, final HttpContext context)

Implements org.apache.hc.client5.http.UserTokenHandler.getUserToken.

Doc from org.apache.hc.client5.http.UserTokenHandler.getUserToken.

The token object returned by this method is expected to uniquely identify the current user if the context is user specific or to be null if it is not.

Parameters
route:HttpRoute

HTTP route

context:HttpContext

the execution context

Returns:Object

user token that uniquely identifies the user or null if the context is not user specific.

Annotations
@Override
getUserTokenback to summary
public Object getUserToken(final HttpRoute route, final HttpRequest request, final HttpContext context)

Overrides default org.apache.hc.client5.http.UserTokenHandler.getUserToken.

Doc from org.apache.hc.client5.http.UserTokenHandler.getUserToken.

The token object returned by this method is expected to uniquely identify the current user if the context is user specific or to be null if it is not.

Parameters
route:HttpRoute

HTTP route

request:HttpRequest

HTTP request

context:HttpContext

the execution context

Returns:Object

user token that uniquely identifies the user or null if the context is not user specific.

Annotations
@Override