Top Description Methods
org.apache.http.client

public Interface AuthenticationStrategy

Known Direct Implementers
org.apache.http.impl.client.AuthenticationStrategyAdaptor, org.apache.http.impl.client.AuthenticationStrategyImpl
Imports
java.util.Map, .Queue, org.apache.http.Header, .HttpHost, .HttpResponse, org.apache.http.auth.AuthOption, .AuthScheme, .MalformedChallengeException, org.apache.http.protocol.HttpContext

/** A handler for determining if an HTTP response represents an authentication challenge that was sent back to the client as a result of authentication failure.

Implementations of this interface must be thread-safe. Access to shared data must be synchronized as methods of this interface may be executed from multiple threads.

Since
4.2

Method Summary

Modifier and TypeMethod and Description
public void
authFailed(HttpHost
authentication host.
authhost
,
AuthScheme
authentication scheme used.
authScheme
,
HttpContext
HTTP context.
context
)

Callback invoked in case of unsuccessful authentication.

public void
authSucceeded(HttpHost
authentication host.
authhost
,
AuthScheme
authentication scheme used.
authScheme
,
HttpContext
HTTP context.
context
)

Callback invoked in case of successful authentication.

public Map<String, Header>

Returns:

a collection of challenges keyed by names of corresponding authentication schemes.
getChallenges
(HttpHost
authentication host.
authhost
,
HttpResponse
HTTP response.
response
,
HttpContext
HTTP context.
context
)

Extracts from the given HTTP response a collection of authentication challenges, each of which represents an authentication scheme supported by the authentication host.

public boolean

Returns:

true if user authentication is required, false otherwise.
isAuthenticationRequested
(HttpHost
authentication host.
authhost
,
HttpResponse
HTTP response.
response
,
HttpContext
HTTP context.
context
)

Determines if the given HTTP response response represents an authentication challenge that was sent back as a result of authentication failure.

public Queue<AuthOption>

Returns:

authentication auth schemes that can be used for authentication. Can be empty.
select
(Map<String, Header>
collection of challenges.
challenges
,
HttpHost
authentication host.
authhost
,
HttpResponse
HTTP response.
response
,
HttpContext
HTTP context.
context
)

Selects one authentication challenge out of all available and creates and generates AuthOption instance capable of processing that challenge.

Method Detail

authFailedback to summary
public void authFailed(HttpHost authhost, AuthScheme authScheme, HttpContext context)

Callback invoked in case of unsuccessful authentication.

Parameters
authhost:HttpHost

authentication host.

authScheme:AuthScheme

authentication scheme used.

context:HttpContext

HTTP context.

authSucceededback to summary
public void authSucceeded(HttpHost authhost, AuthScheme authScheme, HttpContext context)

Callback invoked in case of successful authentication.

Parameters
authhost:HttpHost

authentication host.

authScheme:AuthScheme

authentication scheme used.

context:HttpContext

HTTP context.

getChallengesback to summary
public Map<String, Header> getChallenges(HttpHost authhost, HttpResponse response, HttpContext context) throws MalformedChallengeException

Extracts from the given HTTP response a collection of authentication challenges, each of which represents an authentication scheme supported by the authentication host.

Parameters
authhost:HttpHost

authentication host.

response:HttpResponse

HTTP response.

context:HttpContext

HTTP context.

Returns:Map<String, Header>

a collection of challenges keyed by names of corresponding authentication schemes.

Exceptions
MalformedChallengeException:
if one of the authentication challenges is not valid or malformed.
isAuthenticationRequestedback to summary
public boolean isAuthenticationRequested(HttpHost authhost, HttpResponse response, HttpContext context)

Determines if the given HTTP response response represents an authentication challenge that was sent back as a result of authentication failure.

Parameters
authhost:HttpHost

authentication host.

response:HttpResponse

HTTP response.

context:HttpContext

HTTP context.

Returns:boolean

true if user authentication is required, false otherwise.

selectback to summary
public Queue<AuthOption> select(Map<String, Header> challenges, HttpHost authhost, HttpResponse response, HttpContext context) throws MalformedChallengeException

Selects one authentication challenge out of all available and creates and generates AuthOption instance capable of processing that challenge.

Parameters
challenges:Map<String, Header>

collection of challenges.

authhost:HttpHost

authentication host.

response:HttpResponse

HTTP response.

context:HttpContext

HTTP context.

Returns:Queue<AuthOption>

authentication auth schemes that can be used for authentication. Can be empty.

Exceptions
MalformedChallengeException:
if one of the authentication challenges is not valid or malformed.