Top Fields Constructors Methods
org.apache.http.impl.client

pack-priv abstract Class AuthenticationStrategyImpl

extends Object
implements AuthenticationStrategy
Class Inheritance
All Implemented Interfaces
org.apache.http.client.AuthenticationStrategy
Known Direct Subclasses
org.apache.http.impl.client.ProxyAuthenticationStrategy, org.apache.http.impl.client.TargetAuthenticationStrategy
Annotations
@Contract
threading:IMMUTABLE
Imports
java.util.Arrays, .Collection, .Collections, .HashMap, .LinkedList, .List, .Locale, .Map, .Queue, org.apache.commons.logging.Log, .LogFactory, org.apache.http.FormattedHeader, .Header, .HttpHost, .HttpResponse, org.apache.http.annotation.Contract, .ThreadingBehavior, org.apache.http.auth.AuthOption, .AuthScheme, .AuthSchemeProvider, .AuthScope, .Credentials, .MalformedChallengeException, org.apache.http.client.AuthCache, .AuthenticationStrategy, .CredentialsProvider, org.apache.http.client.config.AuthSchemes, .RequestConfig, org.apache.http.client.protocol.HttpClientContext, org.apache.http.config.Lookup, org.apache.http.protocol.HTTP, .HttpContext, org.apache.http.util.Args, .CharArrayBuffer

Field Summary

Modifier and TypeField and Description
private final int
private static final List<String>
private final String
private final Log

Constructor Summary

AccessConstructor and Description
pack-priv
AuthenticationStrategyImpl(final int
for example SC_PROXY_AUTHENTICATION_REQUIRED or SC_UNAUTHORIZED
challengeCode
,
final String
for example "Proxy-Authenticate" or "WWW-Authenticate"
headerName
)

Method Summary

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

Implements org.apache.http.client.AuthenticationStrategy.authFailed.

Callback invoked in case of unsuccessful authentication.
public void
authSucceeded(final HttpHost
authentication host.
authhost
,
final AuthScheme
authentication scheme used.
authScheme
,
final HttpContext
HTTP context.
context
)

Implements org.apache.http.client.AuthenticationStrategy.authSucceeded.

Callback invoked in case of successful authentication.
public Map<String, Header>

Returns:

map: key=lower-cased auth-scheme name, value=Header that contains the challenge
getChallenges
(final HttpHost
authentication host.
authhost
,
final HttpResponse
HTTP response.
response
,
final HttpContext
HTTP context.
context
)

Implements org.apache.http.client.AuthenticationStrategy.getChallenges.

Generates a map of challenge auth-scheme => Header entries.
pack-priv abstract Collection<String>
public boolean
isAuthenticationRequested(final HttpHost
authentication host.
authhost
,
final HttpResponse
HTTP response.
response
,
final HttpContext
HTTP context.
context
)

Implements org.apache.http.client.AuthenticationStrategy.isAuthenticationRequested.

Determines if the given HTTP response response represents an authentication challenge that was sent back as a result of authentication failure.
protected boolean
isCachable(final AuthScheme authScheme)

public Queue<AuthOption>
select(final Map<String, Header>
collection of challenges.
challenges
,
final HttpHost
authentication host.
authhost
,
final HttpResponse
HTTP response.
response
,
final HttpContext
HTTP context.
context
)

Implements org.apache.http.client.AuthenticationStrategy.select.

Selects one authentication challenge out of all available and creates and generates AuthOption instance capable of processing that challenge.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

challengeCodeback to summary
private final int challengeCode
DEFAULT_SCHEME_PRIORITYback to summary
private static final List<String> DEFAULT_SCHEME_PRIORITY
headerNameback to summary
private final String headerName
logback to summary
private final Log log

Constructor Detail

AuthenticationStrategyImplback to summary
pack-priv AuthenticationStrategyImpl(final int challengeCode, final String headerName)
Parameters
challengeCode:int

for example SC_PROXY_AUTHENTICATION_REQUIRED or SC_UNAUTHORIZED

headerName:String

for example "Proxy-Authenticate" or "WWW-Authenticate"

Method Detail

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

Implements org.apache.http.client.AuthenticationStrategy.authFailed.

Doc from org.apache.http.client.AuthenticationStrategy.authFailed.

Callback invoked in case of unsuccessful authentication.

Parameters
authhost:HttpHost

authentication host.

authScheme:AuthScheme

authentication scheme used.

context:HttpContext

HTTP context.

Annotations
@Override
authSucceededback to summary
public void authSucceeded(final HttpHost authhost, final AuthScheme authScheme, final HttpContext context)

Implements org.apache.http.client.AuthenticationStrategy.authSucceeded.

Doc from org.apache.http.client.AuthenticationStrategy.authSucceeded.

Callback invoked in case of successful authentication.

Parameters
authhost:HttpHost

authentication host.

authScheme:AuthScheme

authentication scheme used.

context:HttpContext

HTTP context.

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

Implements org.apache.http.client.AuthenticationStrategy.getChallenges.

Generates a map of challenge auth-scheme => Header entries.

Parameters
authhost:HttpHost

Doc from org.apache.http.client.AuthenticationStrategy.getChallenges.

authentication host.

response:HttpResponse

Doc from org.apache.http.client.AuthenticationStrategy.getChallenges.

HTTP response.

context:HttpContext

Doc from org.apache.http.client.AuthenticationStrategy.getChallenges.

HTTP context.

Returns:Map<String, Header>

map: key=lower-cased auth-scheme name, value=Header that contains the challenge

Annotations
@Override
Exceptions
MalformedChallengeException:

Doc from org.apache.http.client.AuthenticationStrategy.getChallenges.

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

getPreferredAuthSchemesback to summary
pack-priv abstract Collection<String> getPreferredAuthSchemes(RequestConfig config)
isAuthenticationRequestedback to summary
public boolean isAuthenticationRequested(final HttpHost authhost, final HttpResponse response, final HttpContext context)

Implements org.apache.http.client.AuthenticationStrategy.isAuthenticationRequested.

Doc from org.apache.http.client.AuthenticationStrategy.isAuthenticationRequested.

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.

Annotations
@Override
isCachableback to summary
protected boolean isCachable(final AuthScheme authScheme)
selectback to summary
public Queue<AuthOption> select(final Map<String, Header> challenges, final HttpHost authhost, final HttpResponse response, final HttpContext context) throws MalformedChallengeException

Implements org.apache.http.client.AuthenticationStrategy.select.

Doc from org.apache.http.client.AuthenticationStrategy.select.

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.

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