org.apache.commons.httpclient.auth
Class NTLMScheme

java.lang.Object
  |
  +--org.apache.commons.httpclient.auth.AuthSchemeBase
        |
        +--org.apache.commons.httpclient.auth.NTLMScheme

public class NTLMScheme
extends AuthSchemeBase

An implementation of the Microsoft proprietary NTLM authentication scheme. For a detailed explanation of the NTLM scheme please see http://davenport.sourceforge.net/ntlm.html.

Author:
Remy Maucherat, Rodney Waldhoff, Jeff Dever, Ortwin Gl?ck, Sean C. Sullivan, Adrian Sutton, Mike Bowler, Oleg Kalnichevski

Constructor Summary
NTLMScheme(java.lang.String challenge)
          Constructor for the NTLM authentication scheme.
 
Method Summary
 java.lang.String authenticate(Credentials credentials, java.lang.String method, java.lang.String uri)
          Produces NTLM authorization string for the given set of Credentials.
static java.lang.String authenticate(NTCredentials credentials, java.lang.String challenge)
          Create a NTLM authorization string for the given challenge and NT credentials.
 java.lang.String getID()
          Returns a String identifying the authentication challenge.
 java.lang.String getParameter(java.lang.String name)
          Returns the authentication parameter with the given name, if available.
 java.lang.String getRealm()
          The concept of an authentication realm is not supported by the NTLM authentication scheme.
 java.lang.String getSchemeName()
          Returns textual designation of the NTLM authentication scheme.
 
Methods inherited from class org.apache.commons.httpclient.auth.AuthSchemeBase
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NTLMScheme

public NTLMScheme(java.lang.String challenge)
           throws MalformedChallengeException
Constructor for the NTLM authentication scheme.
Parameters:
challenge - The authentication challenge
Throws:
MalformedChallengeException - is thrown if the authentication challenge is malformed
Method Detail

getSchemeName

public java.lang.String getSchemeName()
Returns textual designation of the NTLM authentication scheme.
Returns:
ntlm

getRealm

public java.lang.String getRealm()
The concept of an authentication realm is not supported by the NTLM authentication scheme. Always returns null.
Returns:
null

getID

public java.lang.String getID()
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.

Returns:
String a String identifying the authentication challenge. The returned value may be null.

getParameter

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

There are no valid parameters for NTLM authentication so this method always returns null.

Parameters:
name - The name of the parameter to be returned
Returns:
the parameter with the given name

authenticate

public static java.lang.String authenticate(NTCredentials credentials,
                                            java.lang.String challenge)
                                     throws AuthenticationException
Create a NTLM authorization string for the given challenge and NT credentials.
Parameters:
challenge - The challenge.
credentials - NTCredentials
Returns:
a ntlm authorization string
Throws:
AuthenticationException - is thrown if authentication fails

authenticate

public java.lang.String authenticate(Credentials credentials,
                                     java.lang.String method,
                                     java.lang.String uri)
                              throws AuthenticationException
Produces NTLM authorization string for the given set of Credentials.
Parameters:
credentials - The set of credentials to be used for athentication
method - Method name is ignored by the NTLM authentication scheme
uri - URI is ignored by the NTLM authentication scheme
Returns:
an NTLM authorization string
Throws:
AuthenticationException - if authorization string cannot be generated due to an authentication failure


Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.