directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r895246 - in /directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server: annotations/CreateLdapServer.java factory/ServerAnnotationProcessor.java
Date Sat, 02 Jan 2010 18:03:10 GMT
Author: kayyagari
Date: Sat Jan  2 18:03:10 2010
New Revision: 895246

URL: http://svn.apache.org/viewvc?rev=895246&view=rev
Log:
implemented support for adding SASL mechanisms, NTLM provider and setting SASL host name

Modified:
    directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateLdapServer.java
    directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java

Modified: directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateLdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateLdapServer.java?rev=895246&r1=895245&r2=895246&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateLdapServer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/annotations/CreateLdapServer.java
Sat Jan  2 18:03:10 2010
@@ -73,5 +73,14 @@
     String certificatePassword() default "";
     
     /** name of the classes implementing extended operations */
-    Class<?>[] extendedOpHandlers() default {};  
+    Class<?>[] extendedOpHandlers() default {};
+    
+    /** supported set of SASL mechanisms */
+    SaslMechanism[] saslMechanisms() default {};
+    
+    /** NTLM provider class, default value is a invalid class */
+    Class<?> ntlmProvider() default Object.class;
+    
+    /** The name of this host, validated during SASL negotiation. */
+    String saslHost() default "ldap.example.com";
 }
\ No newline at end of file

Modified: directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java?rev=895246&r1=895245&r2=895246&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java
(original)
+++ directory/apacheds/branches/apacheds-schema/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java
Sat Jan  2 18:03:10 2010
@@ -20,17 +20,29 @@
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.directory.server.annotations.CreateKdcServer;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
+import org.apache.directory.server.annotations.SaslMechanism;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.kerberos.kdc.KdcServer;
 import org.apache.directory.server.ldap.ExtendedOperationHandler;
 import org.apache.directory.server.ldap.LdapServer;
+import org.apache.directory.server.ldap.handlers.bind.MechanismHandler;
+import org.apache.directory.server.ldap.handlers.bind.cramMD5.CramMd5MechanismHandler;
+import org.apache.directory.server.ldap.handlers.bind.digestMD5.DigestMd5MechanismHandler;
+import org.apache.directory.server.ldap.handlers.bind.gssapi.GssapiMechanismHandler;
+import org.apache.directory.server.ldap.handlers.bind.ntlm.NtlmMechanismHandler;
+import org.apache.directory.server.ldap.handlers.bind.ntlm.NtlmProvider;
+import org.apache.directory.server.ldap.handlers.bind.plain.PlainMechanismHandler;
+import org.apache.directory.server.ldap.handlers.extended.StoredProcedureExtendedOperationHandler;
 import org.apache.directory.server.protocol.shared.transport.TcpTransport;
 import org.apache.directory.server.protocol.shared.transport.Transport;
 import org.apache.directory.server.protocol.shared.transport.UdpTransport;
+import org.apache.directory.shared.ldap.constants.SupportedSaslMechanisms;
 import org.apache.mina.util.AvailablePortFinder;
 import org.junit.runner.Description;
 
@@ -109,6 +121,8 @@
             // Associate the DS to this LdapServer
             ldapServer.setDirectoryService( directoryService );
 
+            ldapServer.setSaslHost( createLdapServer.saslHost() );
+            
             for( Class<?> extOpClass : createLdapServer.extendedOpHandlers() )
             {
                 try
@@ -122,6 +136,36 @@
                 }
             }
             
+            for( SaslMechanism saslMech : createLdapServer.saslMechanisms() )
+            {
+                try
+                {
+                    MechanismHandler handler = ( MechanismHandler ) saslMech.implClass().newInstance();
+                    ldapServer.addSaslMechanismHandler( saslMech.name(), handler );
+                }
+                catch( Exception e )
+                {
+                    throw new RuntimeException( "Failed to add the SASL mechanism with the
name " + saslMech.name() + " and implementation class " + saslMech.implClass().getName(),
e );
+                }
+            }
+            
+            NtlmMechanismHandler ntlmHandler = ( NtlmMechanismHandler ) ldapServer.getSaslMechanismHandlers().get(
SupportedSaslMechanisms.NTLM );
+            if( ntlmHandler != null )
+            {
+                Class<?> ntlmProviderClass = createLdapServer.ntlmProvider();
+                if( ntlmProviderClass != null )
+                {
+                    try
+                    {
+                        ntlmHandler.setNtlmProvider( ( NtlmProvider ) ntlmProviderClass.newInstance()
);
+                    }
+                    catch( Exception e )
+                    {
+                        throw new RuntimeException( "Failed to add NTLM provider", e );
+                    }
+                }
+            }
+        
             // Launch the server
             try
             {



Mime
View raw message