au.net.ocean.httpclient.auth.spnego
Class SPNegoAuthScheme

java.lang.Object
  extended by au.net.ocean.httpclient.auth.spnego.SPNegoAuthScheme
All Implemented Interfaces:
org.apache.commons.httpclient.auth.AuthScheme

public class SPNegoAuthScheme
extends java.lang.Object
implements org.apache.commons.httpclient.auth.AuthScheme

Created by dwhitla at Apr 15, 2007 4:20:35 PM

Version:
$Id: SPNegoAuthScheme.java 0 Apr 15, 2007 4:20:35 PM dwhitla $
Author:
Dave Whitla

Field Summary
static java.lang.String IDENTIFIER
           
 
Constructor Summary
SPNegoAuthScheme()
           
 
Method Summary
 java.lang.String authenticate(org.apache.commons.httpclient.Credentials credentials, org.apache.commons.httpclient.HttpMethod method)
          Produces an authorization string for the given set of Credentials.
 java.lang.String authenticate(org.apache.commons.httpclient.Credentials credentials, java.lang.String method, java.lang.String uri)
          Deprecated. Use authenticate(org.apache.commons.httpclient.Credentials,org.apache.commons.httpclient.HttpMethod)

Produces an authorization string for the given set of Credentials, method name and URI using the given authentication scheme in response to the actual authorization challenge.

 java.lang.String getID()
          Deprecated. no longer used
 java.lang.String getParameter(java.lang.String name)
          Returns authentication parameter with the given name, if available.
 java.lang.String getRealm()
          Returns authentication realm.
 java.lang.String getSchemeName()
           
 boolean isComplete()
          Authentication process may involve a series of challenge-response exchanges.
 boolean isConnectionBased()
          Tests if the authentication scheme provides authorization on a per connection basis instead of usual per request basis
 void processChallenge(java.lang.String challenge)
          Processes the given challenge token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDENTIFIER

public static final java.lang.String IDENTIFIER
See Also:
Constant Field Values
Constructor Detail

SPNegoAuthScheme

public SPNegoAuthScheme()
Method Detail

processChallenge

public void processChallenge(java.lang.String challenge)
                      throws org.apache.commons.httpclient.auth.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 org.apache.commons.httpclient.auth.AuthScheme
Parameters:
challenge - the challenge string
Throws:
org.apache.commons.httpclient.auth.MalformedChallengeException
Since:
3.0

getSchemeName

public java.lang.String getSchemeName()
Specified by:
getSchemeName in interface org.apache.commons.httpclient.auth.AuthScheme

getParameter

public java.lang.String getParameter(java.lang.String name)
Returns authentication parameter with the given name, if available.

Specified by:
getParameter in interface org.apache.commons.httpclient.auth.AuthScheme
Parameters:
name - The name of the parameter to be returned
Returns:
the parameter with the given name

getRealm

public java.lang.String getRealm()
Returns authentication realm. If the concept of an authentication realm is not applicable to the given authentication scheme, returns null.

Specified by:
getRealm in interface org.apache.commons.httpclient.auth.AuthScheme
Returns:
the authentication realm

isConnectionBased

public boolean isConnectionBased()
Tests if the authentication scheme provides authorization on a per connection basis instead of usual per request basis

Specified by:
isConnectionBased in interface org.apache.commons.httpclient.auth.AuthScheme
Returns:
true if the scheme is connection based, false if the scheme is request based.
Since:
3.0

isComplete

public boolean isComplete()
Authentication process may involve a series of challenge-response exchanges. This method tests if the authorization process has been completed, either successfully or unsuccessfully, that is, all the required authorization challenges have been processed in their entirety.

Specified by:
isComplete in interface org.apache.commons.httpclient.auth.AuthScheme
Returns:
true if the authentication process has been completed, false otherwise.
Since:
3.0

authenticate

public java.lang.String authenticate(org.apache.commons.httpclient.Credentials credentials,
                                     org.apache.commons.httpclient.HttpMethod method)
                              throws org.apache.commons.httpclient.auth.AuthenticationException
Produces an authorization string for the given set of Credentials.

Specified by:
authenticate in interface org.apache.commons.httpclient.auth.AuthScheme
Parameters:
credentials - The set of credentials to be used for athentication
method - The method being authenticated
Returns:
the authorization string
Throws:
org.apache.commons.httpclient.auth.AuthenticationException - if authorization string cannot be generated due to an authentication failure
Since:
3.0

getID

public java.lang.String getID()
Deprecated. no longer used

Returns a String identifying the authentication challenge. This is used, in combination with the host and port to determine if authorization has already been attempted or not. Schemes which require multiple requests to complete the authentication should return a different value for each stage in the request.

Additionally, the ID should take into account any changes to the authentication challenge and return a different value when appropriate. For example when the realm changes in basic authentication it should be considered a different authentication attempt and a different value should be returned.

Specified by:
getID in interface org.apache.commons.httpclient.auth.AuthScheme
Returns:
String a String identifying the authentication challenge. The returned value may be null.

authenticate

public java.lang.String authenticate(org.apache.commons.httpclient.Credentials credentials,
                                     java.lang.String method,
                                     java.lang.String uri)
                              throws org.apache.commons.httpclient.auth.AuthenticationException
Deprecated. Use authenticate(org.apache.commons.httpclient.Credentials,org.apache.commons.httpclient.HttpMethod)

Produces an authorization string for the given set of Credentials, method name and URI using the given authentication scheme in response to the actual authorization challenge.

Specified by:
authenticate in interface org.apache.commons.httpclient.auth.AuthScheme
Parameters:
credentials - The set of credentials to be used for athentication
method - The name of the method that requires authorization. This parameter may be ignored, if it is irrelevant or not applicable to the given authentication scheme
uri - The URI for which authorization is needed. This parameter may be ignored, if it is irrelevant or not applicable to the given authentication scheme
Returns:
the authorization string
Throws:
org.apache.commons.httpclient.auth.AuthenticationException - if authorization string cannot be generated due to an authentication failure
See Also:
HttpMethod.getName(), HttpMethod.getPath()


Copyright © 2007-2008 Ocean. All Rights Reserved.