You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/05/12 03:01:49 UTC

svn commit: r655383 - in /directory/apacheds/trunk: protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/ server-unit/src/test/java/org/apache/directory/server/

Author: akarasulu
Date: Sun May 11 18:01:49 2008
New Revision: 655383

URL: http://svn.apache.org/viewvc?rev=655383&view=rev
Log:
adding additional IoSession parameter to be used by the NtlmProvider to temporarily store session specific information there by avoiding threading issues

Modified:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmProvider.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmSaslServer.java
    directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmProvider.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmProvider.java?rev=655383&r1=655382&r2=655383&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmProvider.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmProvider.java Sun May 11 18:01:49 2008
@@ -20,13 +20,16 @@
 package org.apache.directory.server.ldap.handlers.bind.ntlm;
 
 
+import org.apache.mina.common.IoSession;
+
+
 /**
  * An NTLM authentication service provider.  Multiple providers may be
  * utilized to conduct the NTLM negotiation over various protocols or by
  * calling native SSPI interfaces.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $$Rev$$
+ * @version $Rev$
  */
 public interface NtlmProvider
 {
@@ -34,17 +37,19 @@
      * Handles a Type 1 NTLM response from the client to generate an NTLM
      * Type 2 challenge message.
      *
+     * @param session the MINA IoSession to store any state to be thread safe
      * @param type1reponse the Type 1 NTLM response from client
      * @return the NTLM Type 2 message with the challenge
      */
-    byte[] generateChallenge( byte[] type1reponse ) throws Exception;
+    byte[] generateChallenge( IoSession session, byte[] type1reponse ) throws Exception;
 
 
     /**
-     * Handles a Type 3 NTLM reponse from the client.
+     * Handles a Type 3 NTLM response from the client.
      *
-     * @param type3response the Type 3 NTLM reponse from the client
+     * @param session the MINA IoSession to store any state to be thread safe
+     * @param type3response the Type 3 NTLM response from the client
      * @return the result of the successful authentication from the server
      */
-    NtlmAuthenticationResult authenticate( byte[] type3response ) throws Exception;
+    NtlmAuthenticationResult authenticate( IoSession session, byte[] type3response ) throws Exception;
 }

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmSaslServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmSaslServer.java?rev=655383&r1=655382&r2=655383&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmSaslServer.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/ntlm/NtlmSaslServer.java Sun May 11 18:01:49 2008
@@ -121,7 +121,7 @@
             case TYPE_1_RECEIVED:
                 try
                 {
-                    retval = provider.generateChallenge( response );
+                    retval = provider.generateChallenge( session, response );
                 }
                 catch ( Exception e )
                 {
@@ -132,7 +132,7 @@
                 NtlmAuthenticationResult result = null;
                 try
                 {
-                    result = provider.authenticate( response );
+                    result = provider.authenticate( session, response );
                     retval = result.getResponse();
                     session.setAttribute( Context.SECURITY_PRINCIPAL, request.getName().toString() );
                 }

Modified: directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java?rev=655383&r1=655382&r2=655383&view=diff
==============================================================================
--- directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java (original)
+++ directory/apacheds/trunk/server-unit/src/test/java/org/apache/directory/server/SaslBindITest.java Sun May 11 18:01:49 2008
@@ -42,6 +42,7 @@
 import org.apache.directory.shared.ldap.message.spi.BinaryAttributeDetector;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.constants.SupportedSaslMechanisms;
+import org.apache.mina.common.IoSession;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -568,14 +569,14 @@
         private byte[] type3response;
         
         
-        public NtlmAuthenticationResult authenticate( byte[] type3response ) throws Exception
+        public NtlmAuthenticationResult authenticate( IoSession session, byte[] type3response ) throws Exception
         {
             this.type3response = type3response;
             return new NtlmAuthenticationResult( "results".getBytes(), true );
         }
 
 
-        public byte[] generateChallenge( byte[] type1reponse ) throws Exception
+        public byte[] generateChallenge( IoSession session, byte[] type1reponse ) throws Exception
         {
             this.type1response = type1reponse;
             return "challenge".getBytes();