org.apache.http.impl.auth
Class AuthSchemeBase

java.lang.Object
  extended by org.apache.http.impl.auth.AuthSchemeBase
All Implemented Interfaces:
AuthScheme, ContextAwareAuthScheme
Direct Known Subclasses:
GGSSchemeBase, NTLMScheme, RFC2617Scheme

public abstract class AuthSchemeBase
extends Object
implements ContextAwareAuthScheme

Abstract authentication scheme class that serves as a basis for all authentication schemes supported by HttpClient. This class defines the generic way of parsing an authentication challenge. It does not make any assumptions regarding the format of the challenge nor does it impose any specific way of responding to that challenge.

Since:
4.0

Field Summary
protected  ChallengeState challengeState
           
 
Constructor Summary
AuthSchemeBase()
           
AuthSchemeBase(ChallengeState challengeState)
          Deprecated. (4.3) do not use.
 
Method Summary
 org.apache.http.Header authenticate(Credentials credentials, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context)
          Produces an authorization string for the given set of Credentials.
 ChallengeState getChallengeState()
          Returns ChallengeState value or null if unchallenged.
 boolean isProxy()
          Returns true if authenticating against a proxy, false otherwise.
protected abstract  void parseChallenge(org.apache.http.util.CharArrayBuffer buffer, int beginIndex, int endIndex)
           
 void processChallenge(org.apache.http.Header header)
          Processes the given challenge token.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.http.auth.AuthScheme
authenticate, getParameter, getRealm, getSchemeName, isComplete, isConnectionBased
 

Field Detail

challengeState

protected ChallengeState challengeState
Constructor Detail

AuthSchemeBase

@Deprecated
public AuthSchemeBase(ChallengeState challengeState)
Deprecated. (4.3) do not use.

Creates an instance of AuthSchemeBase with the given challenge state.

Since:
4.2

AuthSchemeBase

public AuthSchemeBase()
Method Detail

processChallenge

public void processChallenge(org.apache.http.Header header)
                      throws MalformedChallengeException
Processes the given challenge token. Some authentication schemes may involve multiple challenge-response exchanges. Such schemes must be able to maintain the state information when dealing with sequential challenges

Specified by:
processChallenge in interface AuthScheme
Parameters:
header - the challenge header
Throws:
MalformedChallengeException - is thrown if the authentication challenge is malformed

authenticate

public org.apache.http.Header authenticate(Credentials credentials,
                                           org.apache.http.HttpRequest request,
                                           org.apache.http.protocol.HttpContext context)
                                    throws AuthenticationException
Description copied from interface: ContextAwareAuthScheme
Produces an authorization string for the given set of Credentials.

Specified by:
authenticate in interface ContextAwareAuthScheme
Parameters:
credentials - The set of credentials to be used for athentication
request - The request being authenticated
context - HTTP context
Returns:
the authorization string
Throws:
AuthenticationException - if authorization string cannot be generated due to an authentication failure

parseChallenge

protected abstract void parseChallenge(org.apache.http.util.CharArrayBuffer buffer,
                                       int beginIndex,
                                       int endIndex)
                                throws MalformedChallengeException
Throws:
MalformedChallengeException

isProxy

public boolean isProxy()
Returns true if authenticating against a proxy, false otherwise.


getChallengeState

public ChallengeState getChallengeState()
Returns ChallengeState value or null if unchallenged.

Since:
4.2

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1999–2019 The Apache Software Foundation. All rights reserved.