You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/12/09 19:15:28 UTC

svn commit: r1044059 - in /directory/apacheds/branches/antoine: core-annotations/src/main/java/org/apache/directory/server/core/annotations/ core-annotations/src/main/java/org/apache/directory/server/core/factory/ core/src/main/java/org/apache/director...

Author: elecharny
Date: Thu Dec  9 18:15:27 2010
New Revision: 1044059

URL: http://svn.apache.org/viewvc?rev=1044059&view=rev
Log:
Various small fixes and cleanup. Build is running OK. ready for the merge

Modified:
    directory/apacheds/branches/antoine/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java
    directory/apacheds/branches/antoine/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
    directory/apacheds/branches/antoine/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
    directory/apacheds/branches/antoine/core/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
    directory/apacheds/branches/antoine/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
    directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java
    directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticatorBean.java
    directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/DelegatingAuthenticatorBean.java
    directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/SimpleAuthenticatorBean.java
    directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/StrongAuthenticatorBean.java
    directory/apacheds/branches/antoine/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java
    directory/apacheds/branches/antoine/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
    directory/apacheds/branches/antoine/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java

Modified: directory/apacheds/branches/antoine/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/antoine/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java?rev=1044059&r1=1044058&r2=1044059&view=diff
==============================================================================
--- directory/apacheds/branches/antoine/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java (original)
+++ directory/apacheds/branches/antoine/core-annotations/src/main/java/org/apache/directory/server/core/annotations/CreateAuthenticator.java Thu Dec  9 18:15:27 2010
@@ -44,9 +44,10 @@ public @interface CreateAuthenticator
 {
     /** The authenticator implementation class */
     Class<? extends Authenticator> type() default AnonymousAuthenticator.class;
+    
     /** Delegate host, use for testing DelegatingAuthenticator */
     String delegateHost() default "localhost";
+    
     /** Delegate port, use for testing DelegatingAuthenticator */
     int delegatePort() default -1;
-    
 }

Modified: directory/apacheds/branches/antoine/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/antoine/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java?rev=1044059&r1=1044058&r2=1044059&view=diff
==============================================================================
--- directory/apacheds/branches/antoine/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java (original)
+++ directory/apacheds/branches/antoine/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java Thu Dec  9 18:15:27 2010
@@ -56,14 +56,12 @@ import org.slf4j.LoggerFactory;
 /**
  * A Helper class used to create a DS from the annotations
  * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory
- *         Project</a>
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class DSAnnotationProcessor
 {
     /** A logger for this class */
-    private static final Logger LOG = LoggerFactory
-            .getLogger( DSAnnotationProcessor.class );
+    private static final Logger LOG = LoggerFactory.getLogger( DSAnnotationProcessor.class );
 
 
     /**
@@ -91,6 +89,7 @@ public class DSAnnotationProcessor
         if ( dsBuilder.authenticators().length != 0 )
         {
             AuthenticationInterceptor authenticationInterceptor = null;
+            
             for ( Interceptor interceptor : interceptorList )
             {
                 if ( interceptor instanceof AuthenticationInterceptor )
@@ -99,23 +98,27 @@ public class DSAnnotationProcessor
                     break;
                 }
             }
+            
             if ( authenticationInterceptor == null )
             {
                 throw new IllegalStateException(
                         "authentication interceptor not found" );
             }
+            
             Set<Authenticator> authenticators = new HashSet<Authenticator>();
 
             for ( CreateAuthenticator createAuthenticator : dsBuilder
                     .authenticators() )
             {
                 Authenticator auth = createAuthenticator.type().newInstance();
+                
                 if ( auth instanceof DelegatingAuthenticator )
                 {
                     DelegatingAuthenticator dauth = ( DelegatingAuthenticator ) auth;
                     dauth.setDelegateHost( createAuthenticator.delegateHost() );
                     dauth.setDelegatePort( createAuthenticator.delegatePort() );
                 }
+                
                 authenticators.add( auth );
             }
         }
@@ -142,6 +145,7 @@ public class DSAnnotationProcessor
                         .getPartitionsDirectory(), createPartition.name() ) );
 
                 CreateIndex[] indexes = createPartition.indexes();
+                
                 for ( CreateIndex createIndex : indexes )
                 {
                     partitionFactory.addIndex( partition,
@@ -201,9 +205,8 @@ public class DSAnnotationProcessor
     /**
      * Create a DirectoryService from a Unit test annotation
      * 
-     * @param description
-     *            The annotations containing the info from which we will create
-     *            the DS
+     * @param description The annotations containing the info from which we will create
+     *  the DS
      * @return A valid DS
      */
     public static DirectoryService getDirectoryService( Description description )

Modified: directory/apacheds/branches/antoine/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/antoine/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1044059&r1=1044058&r2=1044059&view=diff
==============================================================================
--- directory/apacheds/branches/antoine/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java (original)
+++ directory/apacheds/branches/antoine/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java Thu Dec  9 18:15:27 2010
@@ -127,14 +127,15 @@ public class AuthenticationInterceptor e
      */
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
-    private Set<Authenticator> authenticators = new TreeSet<Authenticator>();
+    /** A Set of all the existing Authenticator to be used by the bind operation */
+    private Set<Authenticator> authenticators = new HashSet<Authenticator>();
+    
+    /** A map of authenticators associated with the authentication level required */
     private final Map<AuthenticationLevel, Collection<Authenticator>> authenticatorsMapByType = new HashMap<AuthenticationLevel, Collection<Authenticator>>();
 
     /** A reference to the DirectoryService instance */
     private DirectoryService directoryService;
 
-    //private PasswordPolicyConfiguration policyConfig;
-
     /** A reference to the SchemaManager instance */
     private SchemaManager schemaManager;
 
@@ -204,10 +205,11 @@ public class AuthenticationInterceptor e
 
         loadPwdPolicyStateAtributeTypes();
 
-        if ( authenticators == null || authenticators.size() == 0 )
+        if ( ( authenticators == null ) || ( authenticators.size() == 0 ) )
         {
             setDefaultAuthenticators();
         }
+        
         // Register all authenticators
         for ( Authenticator authenticator : authenticators )
         {
@@ -216,14 +218,20 @@ public class AuthenticationInterceptor e
     }
 
 
+    /**
+     * Initialize the set of authenticators with some default values
+     */
     private void setDefaultAuthenticators()
     {
-        Set<Authenticator> set = new HashSet<Authenticator>();
-        set.add( new AnonymousAuthenticator() );
-        set.add( new SimpleAuthenticator() );
-        set.add( new StrongAuthenticator() );
-
-        setAuthenticators( set );
+        if ( authenticators == null )
+        {
+            authenticators = new HashSet<Authenticator>();
+        }
+        
+        authenticators.clear();
+        authenticators.add( new AnonymousAuthenticator() );
+        authenticators.add( new SimpleAuthenticator() );
+        authenticators.add( new StrongAuthenticator() );
     }
 
 
@@ -238,7 +246,14 @@ public class AuthenticationInterceptor e
      */
     public void setAuthenticators( Set<Authenticator> authenticators )
     {
-        this.authenticators = authenticators;
+        if ( authenticators == null )
+        {
+            this.authenticators.clear();
+        }
+        else
+        {
+            this.authenticators = authenticators;
+        }
     }
 
 
@@ -247,13 +262,20 @@ public class AuthenticationInterceptor e
      */
     public void setAuthenticators( Authenticator[] authenticators )
     {
+        if ( authenticators == null )
+        {
+            throw new IllegalArgumentException( "The given authenticators set is null" );
+        }
+        
         this.authenticators.clear();
-        Set<Authenticator> set = new HashSet<Authenticator>();
-        for (Authenticator authenticator : authenticators) {
-            set.add( authenticator );
+
+        for (Authenticator authenticator : authenticators) 
+        {
+            this.authenticators.add( authenticator );
         }
-        setAuthenticators( set );
     }
+    
+    
     /**
      * Deinitializes and deregisters all {@link Authenticator}s from this service.
      */
@@ -1099,6 +1121,11 @@ public class AuthenticationInterceptor e
     }
 
 
+    /**
+     * Initialize the PasswordPolicy attributeTypes
+     * 
+     * @throws LdapException If the initialization failed
+     */
     public void loadPwdPolicyStateAtributeTypes() throws LdapException
     {
         if ( directoryService.isPwdPolicyEnabled() )
@@ -1495,6 +1522,4 @@ public class AuthenticationInterceptor e
             this.newPwd = newPwd;
         }
     }
-
-
 }

Modified: directory/apacheds/branches/antoine/core/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/antoine/core/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java?rev=1044059&r1=1044058&r2=1044059&view=diff
==============================================================================
--- directory/apacheds/branches/antoine/core/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java (original)
+++ directory/apacheds/branches/antoine/core/src/main/java/org/apache/directory/server/core/authn/DelegatingAuthenticator.java Thu Dec  9 18:15:27 2010
@@ -20,9 +20,6 @@
 package org.apache.directory.server.core.authn;
 
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapConnectionFactory;
 import org.apache.directory.server.core.LdapPrincipal;
@@ -45,6 +42,15 @@ import org.apache.directory.shared.ldap.
  */
 public class DelegatingAuthenticator extends AbstractAuthenticator
 {
+    /** A speedup for logger in debug mode */
+    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
+    
+    /** The host in charge of delegated authentication */
+    private String delegateHost;
+    
+    /** The associated port */
+    private int delegatePort;
+    
     /**
      * Creates a new instance.
      * @see AbstractAuthenticator
@@ -55,67 +61,75 @@ public class DelegatingAuthenticator ext
     }
 
 
+    /**
+     * Creates a new instance, for a specific authentication level.
+     * @see AbstractAuthenticator
+     * @param type The relevant AuthenticationLevel
+     */
     protected DelegatingAuthenticator( AuthenticationLevel type )
     {
         super( type );
     }
 
-    /** A speedup for logger in debug mode */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-    private String delegateHost;
-    private int delegatePort;
-    private List<String> dnPatterns = new ArrayList<String>();
-
 
+    /**
+     * @return the delegateHost
+     */
     public String getDelegateHost()
     {
         return delegateHost;
     }
 
 
+    /**
+     * @param delegateHost the delegateHost to set
+     */
     public void setDelegateHost( String delegateHost )
     {
         this.delegateHost = delegateHost;
     }
 
 
+    /**
+     * @return the delegatePort
+     */
     public int getDelegatePort()
     {
         return delegatePort;
     }
 
 
+    /**
+     * @param delegatePort the delegatePort to set
+     */
     public void setDelegatePort( int delegatePort )
     {
         this.delegatePort = delegatePort;
     }
 
 
-    public List<String> getDnPatterns()
-    {
-        return dnPatterns;
-    }
-
-
-    public void setDnPatterns( List<String> dnPatterns )
-    {
-        this.dnPatterns = dnPatterns;
-    }
-
-
+    /**
+     * {@inheritDoc}
+     */
     public LdapPrincipal authenticate( BindOperationContext bindContext )
             throws Exception
     {
         LdapPrincipal principal = null;
+        
         if ( IS_DEBUG )
         {
             LOG.debug( "Authenticating {}", bindContext.getDn() );
         }
+        
+        // Create a connection on the remote host 
         LdapConnection ldapConnection = LdapConnectionFactory.getNetworkConnection( delegateHost, delegatePort );
+        
         try
         {
+            // Try to bind
             BindResponse bindResponse = ldapConnection.bind( bindContext.getDn(),
                 StringTools.utf8ToString( bindContext.getCredentials() ) );
+            
             if ( bindResponse.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
             {
                 String message = I18n.err( I18n.ERR_230, bindContext.getDn().getName() );
@@ -127,9 +141,12 @@ public class DelegatingAuthenticator ext
                 // no need to remain bound to delegate host
                 ldapConnection.unBind();
             }
+            
             // Create the new principal
             principal = new LdapPrincipal( bindContext.getDn(), AuthenticationLevel.SIMPLE,
                 bindContext.getCredentials() );
+            
+            return principal;
 
         }
         catch ( LdapException e )
@@ -139,27 +156,23 @@ public class DelegatingAuthenticator ext
             LOG.info( message );
             throw new LdapAuthenticationException( message );
         }
-        return principal;
     }
 
 
+    /**
+     * We don't handle any password policy when using a delegated authentication
+     */
     public void checkPwdPolicy( Entry userEntry ) throws LdapException
     {
         // no check for delegating authentication
-
-    }
-
-
-    public AuthenticationLevel getAuthenticatorType()
-    {
-        return AuthenticationLevel.SIMPLE;
     }
 
 
+    /**
+     * We don't handle any cache when using a delegated authentication
+     */
     public void invalidateCache( DN bindDn )
     {
         // cache is not implemented here
-
     }
-
 }

Modified: directory/apacheds/branches/antoine/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/antoine/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java?rev=1044059&r1=1044058&r2=1044059&view=diff
==============================================================================
--- directory/apacheds/branches/antoine/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java (original)
+++ directory/apacheds/branches/antoine/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java Thu Dec  9 18:15:27 2010
@@ -146,14 +146,8 @@ public class BindHandler extends LdapReq
             if ( principalEntry == null )
             {
                 LOG.info( "The {} principalDN cannot be found in the server : bind failure.", bindRequest.getName() );
-//                LdapResult result = bindRequest.getResultResponse().getLdapResult();
-//                result.setErrorMessage( "cannot bind the principalDn." );
-//                result.setResultCode( ResultCodeEnum.INVALID_CREDENTIALS );
-//                ldapSession.getIoSession().write( bindRequest.getResultResponse() );
-//                return;
             }
-
-            if ( principalEntry != null && ( ( ClonedServerEntry ) principalEntry ).getOriginalEntry().contains( SchemaConstants.OBJECT_CLASS_AT,
+            else if ( ( ( ClonedServerEntry ) principalEntry ).getOriginalEntry().contains( SchemaConstants.OBJECT_CLASS_AT,
                 SchemaConstants.REFERRAL_OC ) )
             {
                 LOG.info( "Bind principalDn points to referral." );

Modified: directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java?rev=1044059&r1=1044058&r2=1044059&view=diff
==============================================================================
--- directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java (original)
+++ directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java Thu Dec  9 18:15:27 2010
@@ -1,16 +1,46 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
 package org.apache.directory.server.config.beans;
 
 import java.util.ArrayList;
 import java.util.List;
 
+/**
+ * A bean used to store the Zuthentictor interceptor condifuration
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
 public class AuthenticationInterceptorBean extends InterceptorBean
 {
     /** The list of authenticators */
     private List<AuthenticatorBean> authenticators = new ArrayList<AuthenticatorBean>();
 
-    public AuthenticationInterceptorBean() {
+    /**
+     * Creates a new AuthenticationInterceptorBean instance
+     */
+    public AuthenticationInterceptorBean() 
+    {
         super();
     }
+    
+    
     /**
      * @param authenticators the authenticators to set
      */
@@ -30,6 +60,7 @@ public class AuthenticationInterceptorBe
             this.authenticators.add( authenticator );
         }
     }
+    
 
     /**
      * @return the extendedOps
@@ -38,6 +69,7 @@ public class AuthenticationInterceptorBe
     {
         return authenticators;
     }
+    
 
     /**
      * {@inheritDoc}
@@ -48,16 +80,17 @@ public class AuthenticationInterceptorBe
         
         sb.append( tabs ).append( "AuthenticationInterceptor :\n" );
         sb.append( super.toString( tabs + "  " ) );
-        if ((authenticators != null) && (authenticators.size() > 0))
+        
+        if ( ( authenticators != null ) && ( authenticators.size() > 0 ) )
         {
             sb.append( tabs ).append( "  authenticator :\n" );
 
-            for (AuthenticatorBean authenticator : authenticators)
+            for ( AuthenticatorBean authenticator : authenticators )
             {
                 sb.append( authenticator.toString( tabs + "    " ) );
             }
         }
+        
         return sb.toString();
     }
-
 }

Modified: directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticatorBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticatorBean.java?rev=1044059&r1=1044058&r2=1044059&view=diff
==============================================================================
--- directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticatorBean.java (original)
+++ directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticatorBean.java Thu Dec  9 18:15:27 2010
@@ -1,9 +1,34 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
 package org.apache.directory.server.config.beans;
 
+/**
+ * Base authenticator bean
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
 public abstract class AuthenticatorBean extends AdsBaseBean
 {
     /** The authenticator id */
     private String authenticatorId;
+    
     /**
      * @return the authenticatorId
      */
@@ -20,5 +45,4 @@ public abstract class AuthenticatorBean 
     {
         this.authenticatorId = authenticatorId;
     }
-
 }

Modified: directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/DelegatingAuthenticatorBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/DelegatingAuthenticatorBean.java?rev=1044059&r1=1044058&r2=1044059&view=diff
==============================================================================
--- directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/DelegatingAuthenticatorBean.java (original)
+++ directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/DelegatingAuthenticatorBean.java Thu Dec  9 18:15:27 2010
@@ -33,8 +33,6 @@ public class DelegatingAuthenticatorBean
     /** The delegate port */
     private int delegatePort;
 
-    
-
 
 
     /**
@@ -97,6 +95,5 @@ public class DelegatingAuthenticatorBean
     {
         return toString( "" );
     }
-    
 
 }

Modified: directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/SimpleAuthenticatorBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/SimpleAuthenticatorBean.java?rev=1044059&r1=1044058&r2=1044059&view=diff
==============================================================================
--- directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/SimpleAuthenticatorBean.java (original)
+++ directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/SimpleAuthenticatorBean.java Thu Dec  9 18:15:27 2010
@@ -25,8 +25,6 @@ package org.apache.directory.server.conf
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-
 public class SimpleAuthenticatorBean extends AuthenticatorBean
 {
-
 }

Modified: directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/StrongAuthenticatorBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/StrongAuthenticatorBean.java?rev=1044059&r1=1044058&r2=1044059&view=diff
==============================================================================
--- directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/StrongAuthenticatorBean.java (original)
+++ directory/apacheds/branches/antoine/server-config/src/main/java/org/apache/directory/server/config/beans/StrongAuthenticatorBean.java Thu Dec  9 18:15:27 2010
@@ -25,8 +25,6 @@ package org.apache.directory.server.conf
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-
 public class StrongAuthenticatorBean extends AuthenticatorBean
 {
-
 }

Modified: directory/apacheds/branches/antoine/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/antoine/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java?rev=1044059&r1=1044058&r2=1044059&view=diff
==============================================================================
--- directory/apacheds/branches/antoine/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java (original)
+++ directory/apacheds/branches/antoine/server-integ/src/test/java/org/apache/directory/server/operations/bind/DelegatedAuthIT.java Thu Dec  9 18:15:27 2010
@@ -96,34 +96,43 @@ public class DelegatedAuthIT extends Abs
         assertEquals( "DelegatedAuthIT-method", service.getInstanceId() );
         LdapConnection ldapConnection = LdapConnectionFactory.getNetworkConnection( "localhost", ldapServer.getPort() );
         BindResponse bindResponse = ldapConnection.bind( "uid=antoine,ou=users,ou=system", "secret" );
+        
         if ( bindResponse.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
         {
             fail( "this authentication should have been successful, got result code : "
                 + bindResponse.getLdapResult().getResultCode() );
         }
+        
         ldapConnection.unBind();
         bindResponse = ldapConnection.bind( "uid=antoine,ou=users,ou=system", "sesame" );
+        
         if ( bindResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
         {
             fail( "this authentication should have failed due to wrong password, got result code : "
                 + bindResponse.getLdapResult().getResultCode() );
         }
+        
         ldapConnection.unBind();
+        
         try
         {
             bindResponse = ldapConnection.bind( "uid=ivanhoe,ou=users,ou=system", "secret" );
+        
             if ( bindResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
             {
                 fail( "this authentication should fail, user does not exist, got result code : "
                     + bindResponse.getLdapResult().getResultCode() );
             }
+            
             ldapConnection.unBind();
         }
         catch ( Exception exc )
         {
-            System.out.println( "exception happened" + exc.getMessage() );
+            assertTrue( true );
         }
     }
+    
+    
     /**
      * Test with bindDn which is not even found under any namingContext of the
      * server.
@@ -142,22 +151,22 @@ public class DelegatedAuthIT extends Abs
                 delegateHost = "localhost",
                 delegatePort = 10200),
             @CreateAuthenticator(type = StrongAuthenticator.class)})
-@ApplyLdifs(
-    {
-        // Entry # 1
-        "dn: uid=emmanuel,ou=users,ou=system",
-        "objectClass: uidObject",
-        "objectClass: person",
-        "objectClass: top",
-        "uid: emmanuel",
-        "cn: Emmanuel Lecharny",
-        "sn: Lecharny",
-        "userPassword: sesame" })
-    @CreateLdapServer(
-        transports =
-    {
-        @CreateTransport(protocol = "LDAP")
-    })
+            @ApplyLdifs(
+                {
+                    // Entry # 1
+                    "dn: uid=emmanuel,ou=users,ou=system",
+                    "objectClass: uidObject",
+                    "objectClass: person",
+                    "objectClass: top",
+                    "uid: emmanuel",
+                    "cn: Emmanuel Lecharny",
+                    "sn: Lecharny",
+                    "userPassword: sesame" })
+                @CreateLdapServer(
+                    transports =
+                {
+                    @CreateTransport(protocol = "LDAP")
+                })
     @Test
     public void testMultipleAuthenticators() throws Exception
     {
@@ -165,54 +174,66 @@ public class DelegatedAuthIT extends Abs
         assertEquals( "DelegatedAuthIT-MultipleAuthenticators-method", service.getInstanceId() );
         LdapConnection ldapConnection = LdapConnectionFactory.getNetworkConnection( "localhost", ldapServer.getPort() );
         BindResponse bindResponse = ldapConnection.bind( "uid=emmanuel,ou=users,ou=system", "sesame" );
+
         if ( bindResponse.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
         {
             fail( "this authentication should have been successful through local simple authenticator, got result code : "
                 + bindResponse.getLdapResult().getResultCode() );
         }
+        
         ldapConnection.unBind();
         bindResponse = ldapConnection.bind( "uid=emmanuel,ou=users,ou=system", "crypto" );
+        
         if ( bindResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
         {
             fail( "this authentication should fail due to wrong password, got result code : "
                 + bindResponse.getLdapResult().getResultCode() );
         }
+        
         ldapConnection.unBind();
         bindResponse = ldapConnection.bind();
+        
         if ( bindResponse.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
         {
             fail( "this authentication should have been successful through local anonymous authenticator, got result code : "
                 + bindResponse.getLdapResult().getResultCode() );
         }
+        
         ldapConnection.unBind();
         bindResponse = ldapConnection.bind( "uid=antoine,ou=users,ou=system", "secret" );
+        
         if ( bindResponse.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
         {
             fail( "this authentication should have been successful, got result code : "
                 + bindResponse.getLdapResult().getResultCode() );
         }
+        
         ldapConnection.unBind();
         bindResponse = ldapConnection.bind( "uid=antoine,ou=users,ou=system", "sesame" );
+        
         if ( bindResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
         {
             fail( "this authentication should have failed due to wrong password, got result code : "
                 + bindResponse.getLdapResult().getResultCode() );
         }
+        
         ldapConnection.unBind();
+        
         try
         {
             bindResponse = ldapConnection.bind( "uid=ivanhoe,ou=users,ou=system", "secret" );
+        
             if ( bindResponse.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
             {
                 fail( "this authentication should fail, user does not exist, got result code : "
                     + bindResponse.getLdapResult().getResultCode() );
             }
+            
             ldapConnection.unBind();
         }
         catch ( Exception exc )
         {
-            System.out.println( "exception happened" + exc.getMessage() );
+            assertTrue( true );
         }
     }
-
 }

Modified: directory/apacheds/branches/antoine/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/antoine/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java?rev=1044059&r1=1044058&r2=1044059&view=diff
==============================================================================
--- directory/apacheds/branches/antoine/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java (original)
+++ directory/apacheds/branches/antoine/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java Thu Dec  9 18:15:27 2010
@@ -162,12 +162,14 @@ public class ServiceBuilder
             {
                 LOG.debug( "loading the interceptor class {} and instantiating", interceptorBean.getInterceptorClassName() );
                 Interceptor interceptor = ( Interceptor ) Class.forName( interceptorBean.getInterceptorClassName() ).newInstance();
+                
                 if (interceptorBean instanceof AuthenticationInterceptorBean) {
                     // Transports
                     Authenticator[] authenticators = createAuthenticators( ((AuthenticationInterceptorBean)interceptorBean).getAuthenticators() );
                     ((AuthenticationInterceptor) interceptor).setAuthenticators( authenticators );
                     
                 }
+                
                 interceptors.add( interceptor );
             }
             catch ( Exception e )
@@ -412,10 +414,10 @@ public class ServiceBuilder
      * @param authenticatorBean The created instance of authenticator
      * @return An instance of authenticator
      */
-    public static Authenticator createAuthenticator(
-            AuthenticatorBean authenticatorBean )
+    public static Authenticator createAuthenticator( AuthenticatorBean authenticatorBean )
     {
         Authenticator authenticator = null;
+        
         if (authenticatorBean instanceof SimpleAuthenticatorBean)
         {
             authenticator = new SimpleAuthenticator();
@@ -434,6 +436,7 @@ public class ServiceBuilder
             ((DelegatingAuthenticator)authenticator).setDelegateHost( ((DelegatingAuthenticatorBean) authenticatorBean).getDelegateHost() );
             ((DelegatingAuthenticator)authenticator).setDelegatePort( ((DelegatingAuthenticatorBean) authenticatorBean).getDelegatePort() );
         }
+        
         return authenticator;
     }
 

Modified: directory/apacheds/branches/antoine/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/antoine/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java?rev=1044059&r1=1044058&r2=1044059&view=diff
==============================================================================
--- directory/apacheds/branches/antoine/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java (original)
+++ directory/apacheds/branches/antoine/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java Thu Dec  9 18:15:27 2010
@@ -254,6 +254,9 @@ public class FrameworkRunner extends Blo
     }
 
 
+    /**
+     * Get the lower port out of all the transports
+     */
     private int getMinPort()
     {
         int minPort = 0;
@@ -273,6 +276,7 @@ public class FrameworkRunner extends Blo
                 }
             }
         }
+        
         return minPort;
     }
 
@@ -285,6 +289,7 @@ public class FrameworkRunner extends Blo
     {
         /** The LdapServer for this method, if any */
         LdapServer methodLdapServer = null;
+        
         // Don't run the test if the @Ignored annotation is used
         if ( method.getAnnotation( Ignore.class ) != null )
         {
@@ -307,7 +312,7 @@ public class FrameworkRunner extends Blo
         // Before running any test, check to see if we must create a class DS
         // Get the LdapServerBuilder, if any
         CreateLdapServer methodLdapServerBuilder = methodDescription.getAnnotation( CreateLdapServer.class );
-        //if (meth)
+
         // Ok, ready to run the test
         try
         {
@@ -365,6 +370,7 @@ public class FrameworkRunner extends Blo
 
                 DSAnnotationProcessor.applyLdifs( methodDescription, directoryService );
             }
+
             if ( methodLdapServerBuilder != null )
             {
                 int minPort = getMinPort();