microsoft.exchange.webservices.data
Class EwsJCIFSNTLMScheme

java.lang.Object
  extended by microsoft.exchange.webservices.data.EwsJCIFSNTLMScheme
All Implemented Interfaces:
org.apache.commons.httpclient.auth.AuthScheme

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

This is a reimplementation of HTTPClient 3.x's org.apache.commons.httpclient.auth.NTLMScheme.
It will basically use JCIFS (v1.3.15) in order to provide added support for NTLMv2 (instead of trying to create its own Type, 2 and 3 messages).
This class has to be registered manually with HTTPClient before setting NTCredentials: AuthPolicy.registerAuthScheme(AuthPolicy.NTLM, JCIFS_NTLMScheme.class);
Will not work with HttpClient 4.x which requires AuthEngine to be overriden instead of AuthScheme.


Constructor Summary
EwsJCIFSNTLMScheme()
           
 
Method Summary
 java.lang.String authenticate(org.apache.commons.httpclient.Credentials credentials, org.apache.commons.httpclient.HttpMethod method)
           
 java.lang.String authenticate(org.apache.commons.httpclient.Credentials credentials, java.lang.String method, java.lang.String uri)
           
 java.lang.String getID()
           
 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.
 boolean isComplete()
          Tests if the NTLM authentication process has been completed.
 boolean isConnectionBased()
          Returns true.
 void processChallenge(java.lang.String challenge)
          Processes the NTLM challenge.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EwsJCIFSNTLMScheme

public EwsJCIFSNTLMScheme()
                   throws org.apache.commons.httpclient.auth.AuthenticationException
Throws:
org.apache.commons.httpclient.auth.AuthenticationException
Method Detail

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
Specified by:
authenticate in interface org.apache.commons.httpclient.auth.AuthScheme
Throws:
org.apache.commons.httpclient.auth.AuthenticationException

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
Specified by:
authenticate in interface org.apache.commons.httpclient.auth.AuthScheme
Throws:
org.apache.commons.httpclient.auth.AuthenticationException

getID

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

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.

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()
The concept of an authentication realm is not supported by the NTLM authentication scheme. Always returns null.

Specified by:
getRealm in interface org.apache.commons.httpclient.auth.AuthScheme
Returns:
null

getSchemeName

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

Specified by:
getSchemeName in interface org.apache.commons.httpclient.auth.AuthScheme
Returns:
ntlm

isComplete

public boolean isComplete()
Tests if the NTLM authentication process has been completed.

Specified by:
isComplete in interface org.apache.commons.httpclient.auth.AuthScheme
Returns:
true if Basic authorization has been processed, false otherwise.
Since:
3.0

isConnectionBased

public boolean isConnectionBased()
Returns true. NTLM authentication scheme is connection based.

Specified by:
isConnectionBased in interface org.apache.commons.httpclient.auth.AuthScheme
Returns:
true.
Since:
3.0

processChallenge

public void processChallenge(java.lang.String challenge)
                      throws org.apache.commons.httpclient.auth.MalformedChallengeException
Processes the NTLM challenge.

Specified by:
processChallenge in interface org.apache.commons.httpclient.auth.AuthScheme
Parameters:
challenge - the challenge string
Throws:
org.apache.commons.httpclient.auth.MalformedChallengeException - is thrown if the authentication challenge is malformed
Since:
3.0