directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1482716 - in /directory/apacheds/trunk: core-annotations/src/main/java/org/apache/directory/server/core/annotations/ core-annotations/src/main/java/org/apache/directory/server/core/factory/ interceptors/authn/src/main/java/org/apache/direc...
Date Wed, 15 May 2013 08:09:23 GMT
Author: elecharny
Date: Wed May 15 08:09:23 2013
New Revision: 1482716

URL: http://svn.apache.org/r1482716
Log:
o Added the SSL parameter and the BaseDN in the DelegatingAuthentcator 
o Made the test passes for delegatedAuthentication (without SSL atm)

Modified:
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java
    directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
    directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java?rev=1482716&r1=1482715&r2=1482716&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java
(original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java
Wed May 15 08:09:23 2013
@@ -55,4 +55,8 @@ public @interface CreateAuthenticator
 
     /** Delegate port, use for testing DelegatingAuthenticator */
     int delegatePort() default -1;
+
+
+    /** Tells if we use SSL to connect */
+    boolean delegateSsl() default true;
 }

Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java?rev=1482716&r1=1482715&r2=1482716&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
(original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
Wed May 15 08:09:23 2013
@@ -124,6 +124,7 @@ public class DSAnnotationProcessor
                     DelegatingAuthenticator dauth = ( DelegatingAuthenticator ) auth;
                     dauth.setDelegateHost( createAuthenticator.delegateHost() );
                     dauth.setDelegatePort( createAuthenticator.delegatePort() );
+                    dauth.setDelegateSsl( createAuthenticator.delegateSsl() );
                 }
 
                 authenticators.add( auth );

Modified: directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java?rev=1482716&r1=1482715&r2=1482716&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
(original)
+++ directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
Wed May 15 08:09:23 2013
@@ -52,6 +52,12 @@ public class DelegatingAuthenticator ext
     /** The associated port */
     private int delegatePort;
 
+    /** Tells if we use SSL to connect */
+    private boolean delegateSsl;
+
+    /** The base DN which will be the starting point from which we use the delegator authenticator
*/
+    private String delegateBaseDn;
+
 
     /**
      * Creates a new instance.
@@ -111,6 +117,42 @@ public class DelegatingAuthenticator ext
 
 
     /**
+     * @return the delegateSsl
+     */
+    public boolean isDelegateSsl()
+    {
+        return delegateSsl;
+    }
+
+
+    /**
+     * @param delegateSsl the delegateSsl to set
+     */
+    public void setDelegateSsl( boolean delegateSsl )
+    {
+        this.delegateSsl = delegateSsl;
+    }
+
+
+    /**
+     * @return the delegateBaseDn
+     */
+    public String getDelegateBaseDn()
+    {
+        return delegateBaseDn;
+    }
+
+
+    /**
+     * @param delegateBaseDn the delegateBaseDn to set
+     */
+    public void setDelegateBaseDn( String delegateBaseDn )
+    {
+        this.delegateBaseDn = delegateBaseDn;
+    }
+
+
+    /**
      * {@inheritDoc}
      */
     public LdapPrincipal authenticate( BindOperationContext bindContext )
@@ -124,7 +166,7 @@ public class DelegatingAuthenticator ext
         }
 
         // Create a connection on the remote host
-        LdapConnection ldapConnection = new LdapNetworkConnection( delegateHost, delegatePort
);
+        LdapConnection ldapConnection = new LdapNetworkConnection( delegateHost, delegatePort,
delegateSsl );
 
         try
         {

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java?rev=1482716&r1=1482715&r2=1482716&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java
Wed May 15 08:09:23 2013
@@ -50,23 +50,33 @@ import org.junit.runner.RunWith;
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 @RunWith(FrameworkRunner.class)
+@CreateDS(
+    allowAnonAccess = true,
+    name = "DelegatedAuthIT-class",
+    authenticators =
+        {
+            @CreateAuthenticator(
+                type = DelegatingAuthenticator.class,
+                delegateHost = "localhost",
+                delegatePort = 10201,
+                delegateSsl = false) })
 @ApplyLdifs(
     {
         // Entry # 1
-        "dn: uid=antoine,ou=users,ou=system",
+        "dn: uid=emmanuel,ou=users,ou=system",
         "objectClass: uidObject",
         "objectClass: person",
         "objectClass: top",
-        "uid: antoine",
-        "cn: Antoine Levy-Lambert",
-        "sn: Levy-Lambert",
-        "userPassword: secret" })
-@CreateDS(allowAnonAccess = true, name = "DelegatedAuthIT-class")
+        "uid: emmanuel",
+        "cn: Emmanuel Lecharny",
+        "sn: Lecharny",
+        "userPassword: sesame" })
 @CreateLdapServer(
     transports =
         {
             @CreateTransport(protocol = "LDAP", port = 10200)
-    })
+    },
+    allowAnonymousAccess = true)
 public class DelegatedAuthIT extends AbstractLdapTestUnit
 {
     @Rule
@@ -81,25 +91,29 @@ public class DelegatedAuthIT extends Abs
      */
     @CreateDS(
         allowAnonAccess = true,
-        name = "DelegatedAuthIT-method",
-        authenticators =
-            {
-                @CreateAuthenticator(
-                    type = DelegatingAuthenticator.class,
-                    delegateHost = "localhost",
-                    delegatePort = 10200) })
+        name = "DelegatedAuthIT-method")
+    @ApplyLdifs(
+        {
+            // Entry # 1
+            "dn: uid=antoine,ou=users,ou=system",
+            "objectClass: uidObject",
+            "objectClass: person",
+            "objectClass: top",
+            "uid: antoine",
+            "cn: Antoine Levy-Lambert",
+            "sn: Levy-Lambert",
+            "userPassword: secret" })
     @CreateLdapServer(
         transports =
             {
-                @CreateTransport(protocol = "LDAP")
+                @CreateTransport(protocol = "LDAP", port = 10201)
         })
     @Test
     public void testDelegatedAuthentication() throws Exception
     {
         assertTrue( getService().isStarted() );
         assertEquals( "DelegatedAuthIT-method", getService().getInstanceId() );
-        LdapConnection ldapConnection = new LdapNetworkConnection( "localhost", getLdapServer()
-            .getPort() );
+        LdapConnection ldapConnection = new LdapNetworkConnection( "localhost", 10200 );
 
         ldapConnection.setTimeOut( 0L );
         ldapConnection.bind( "uid=antoine,ou=users,ou=system", "secret" );
@@ -156,25 +170,26 @@ public class DelegatedAuthIT extends Abs
     @ApplyLdifs(
         {
             // Entry # 1
-            "dn: uid=emmanuel,ou=users,ou=system",
+            "dn: uid=antoine,ou=users,ou=system",
             "objectClass: uidObject",
             "objectClass: person",
             "objectClass: top",
-            "uid: emmanuel",
-            "cn: Emmanuel Lecharny",
-            "sn: Lecharny",
-            "userPassword: sesame" })
+            "uid: antoine",
+            "cn: Antoine Levy-Lambert",
+            "sn: Levy-Lambert",
+            "userPassword: secret" })
     @CreateLdapServer(
         transports =
             {
-                @CreateTransport(protocol = "LDAP")
+                @CreateTransport(protocol = "LDAP", port = 10201)
         }, allowAnonymousAccess = true)
     @Test
     public void testMultipleAuthenticators() throws Exception
     {
         assertTrue( getService().isStarted() );
         assertEquals( "DelegatedAuthIT-MultipleAuthenticators-method", getService().getInstanceId()
);
-        LdapConnection ldapConnection = new LdapNetworkConnection( "localhost", getLdapServer().getPort()
);
+        LdapConnection ldapConnection = new LdapNetworkConnection( "localhost", 10200 );
+        ldapConnection.setTimeOut( 0L );
         ldapConnection.bind( "uid=emmanuel,ou=users,ou=system", "sesame" );
 
         assertTrue( ldapConnection.isAuthenticated() );



Mime
View raw message