directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1096034 - in /directory/apacheds/trunk: server-config/src/main/java/org/apache/directory/server/config/ server-config/src/main/java/org/apache/directory/server/config/beans/ server-config/src/main/resources/ server-config/src/test/java/org...
Date Fri, 22 Apr 2011 20:59:59 GMT
Author: elecharny
Date: Fri Apr 22 20:59:58 2011
New Revision: 1096034

URL: http://svn.apache.org/viewvc?rev=1096034&view=rev
Log:
Moved the PPolicy elements from DS to AuthenticationInterceptor

Modified:
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
    directory/apacheds/trunk/server-config/src/main/resources/config.ldif
    directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
    directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java?rev=1096034&r1=1096033&r2=1096034&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
(original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
Fri Apr 22 20:59:58 2011
@@ -44,8 +44,8 @@ import org.apache.directory.server.xdbm.
 import org.apache.directory.server.xdbm.IndexCursor;
 import org.apache.directory.server.xdbm.search.SearchEngine;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.StringValue;
 import org.apache.directory.shared.ldap.model.entry.Value;
 import org.apache.directory.shared.ldap.model.exception.LdapException;

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java?rev=1096034&r1=1096033&r2=1096034&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java
(original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java
Fri Apr 22 20:59:58 2011
@@ -35,6 +35,11 @@ public class AuthenticationInterceptorBe
     @ConfigurationElement(attributeType = "ads-authenticators", container = "authenticators")
     private List<AuthenticatorBean> authenticators = new ArrayList<AuthenticatorBean>();
 
+    /** The reference to the Password Policy component */
+    @ConfigurationElement(attributeType = "ads-passwordPolicies", container = "passwordPolicies")
+    private List<PasswordPolicyBean> passwordPolicies = new ArrayList<PasswordPolicyBean>();
+
+
     /**
      * Creates a new AuthenticationInterceptorBean instance
      */
@@ -75,6 +80,36 @@ public class AuthenticationInterceptorBe
     
 
     /**
+     * @return the passwordPolicies
+     */
+    public List<PasswordPolicyBean> getPasswordPolicies()
+    {
+        return passwordPolicies;
+    }
+
+
+    /**
+     * @param passwordPolicies the pwdPolicies to set
+     */
+    public void setPasswordPolicies( List<PasswordPolicyBean> passwordPolicies )
+    {
+        this.passwordPolicies = passwordPolicies;
+    }
+
+
+    /**
+     * @param ppolicies the password policies to add
+     */
+    public void addPasswordPolicies( PasswordPolicyBean... ppolicies )
+    {
+        for ( PasswordPolicyBean ppolicy : ppolicies )
+        {
+            this.passwordPolicies.add( ppolicy );
+        }
+    }
+
+    
+    /**
      * {@inheritDoc}
      */
     public String toString( String tabs )
@@ -94,6 +129,14 @@ public class AuthenticationInterceptorBe
             }
         }
         
+        if ( ( passwordPolicies != null ) && ( passwordPolicies.size() > 0 ) )
+        {
+            for ( PasswordPolicyBean ppolicy : passwordPolicies )
+            {
+                sb.append( ppolicy.toString( "    " ) );
+            }
+        }
+
         return sb.toString();
     }
 }

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java?rev=1096034&r1=1096033&r2=1096034&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
(original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
Fri Apr 22 20:59:58 2011
@@ -89,11 +89,6 @@ public class DirectoryServiceBean extend
     @ConfigurationElement(attributeType = "ads-partitions", container = "partitions")
     private List<PartitionBean> partitions = new ArrayList<PartitionBean>();
 
-    /** The reference to the Password Policy component */
-    @ConfigurationElement(attributeType = "ads-passwordPolicies", container = "passwordPolicies")
-    private List<PasswordPolicyBean> passwordPolicies = new ArrayList<PasswordPolicyBean>();
-
-
     /**
      * Create a new DnsServerBean instance
      */
@@ -524,36 +519,6 @@ public class DirectoryServiceBean extend
 
 
     /**
-     * @return the passwordPolicies
-     */
-    public List<PasswordPolicyBean> getPasswordPolicies()
-    {
-        return passwordPolicies;
-    }
-
-
-    /**
-     * @param passwordPolicies the pwdPolicies to set
-     */
-    public void setPasswordPolicies( List<PasswordPolicyBean> passwordPolicies )
-    {
-        this.passwordPolicies = passwordPolicies;
-    }
-
-
-    /**
-     * @param ppolicies the password policies to add
-     */
-    public void addPasswordPolicies( PasswordPolicyBean... ppolicies )
-    {
-        for ( PasswordPolicyBean ppolicy : ppolicies )
-        {
-            this.passwordPolicies.add( ppolicy );
-        }
-    }
-
-    
-    /**
      * {@inheritDoc}
      */
     public String toString()
@@ -604,14 +569,6 @@ public class DirectoryServiceBean extend
             sb.append( changeLog.toString( "  " ) );
         }
 
-        if ( ( passwordPolicies != null ) && ( passwordPolicies.size() > 0 ) )
-        {
-            for ( PasswordPolicyBean ppolicy : passwordPolicies )
-            {
-                sb.append( ppolicy.toString( "    " ) );
-            }
-        }
-
         sb.append( "  servers : \n" );
 
         if ( ( servers != null ) && ( servers.size() > 0 ) )

Modified: directory/apacheds/trunk/server-config/src/main/resources/config.ldif
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/resources/config.ldif?rev=1096034&r1=1096033&r2=1096034&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/resources/config.ldif (original)
+++ directory/apacheds/trunk/server-config/src/main/resources/config.ldif Fri Apr 22 20:59:58
2011
@@ -23,7 +23,6 @@ ads-servers: ldapServer
 ads-servers: ntpServer
 ads-partitions: example
 ads-partitions: system
-ads-passwordPolicies: default
 ads-interceptors: aciAuthorizationInterceptor
 ads-interceptors: authenticationInterceptor
 ads-interceptors: collectiveAttributeInterceptor
@@ -79,6 +78,7 @@ ads-interceptororder: 2
 ads-interceptorclassname: org.apache.directory.server.core.authn.AuthenticationInterceptor
 ads-interceptorid: authenticationInterceptor
 ads-enabled: TRUE
+ads-passwordPolicies: default
 ads-authenticators: anonymousauthenticator
 ads-authenticators: simpleauthenticator
 ads-authenticators: strongauthenticator
@@ -109,6 +109,33 @@ objectclass: ads-base
 objectClass: ads-authenticator
 objectClass: ads-strongAuthenticator
 
+dn: ou=passwordPolicies,ads-interceptorId=authenticationInterceptor,ou=interceptors,ads-directoryServiceId=default,ou=config
+objectClass: organizationalUnit
+objectClass: top
+ou: passwordPolicies
+
+dn: ads-pwdId=default,ou=passwordPolicies,ads-interceptorId=authenticationInterceptor,ou=interceptors,ads-directoryServiceId=default,ou=config
+objectClass: top
+objectClass: ads-base
+objectClass: ads-passwordPolicy
+ads-pwdId: default
+ads-pwdSafeModify: FALSE
+ads-pwdMaxAge: 0
+ads-pwdFailureCountInterval: 30
+ads-pwdAttribute: userPassword
+ads-pwdMaxFailure: 5
+ads-pwdLockout: TRUE
+ads-pwdMustChange: FALSE
+ads-pwdLockoutDuration: 0
+ads-pwdMinLength: 5
+ads-pwdInHistory: 5
+ads-pwdExpireWarning: 600
+ads-pwdMinAge: 0
+ads-pwdAllowUserChange: TRUE
+ads-pwdGraceAuthNLimit: 5
+ads-pwdCheckQuality: 2
+ads-enabled: TRUE
+
 dn: ads-interceptorId=collectiveAttributeInterceptor,ou=interceptors,ads-directoryServiceId=default,ou=config
 objectclass: top
 objectclass: ads-base
@@ -217,33 +244,6 @@ ads-interceptorclassname: org.apache.dir
 ads-interceptorid: triggerInterceptor
 ads-enabled: TRUE
 
-dn: ou=passwordPolicies,ads-directoryServiceId=default,ou=config
-objectClass: organizationalUnit
-objectClass: top
-ou: passwordPolicies
-
-dn: ads-pwdId=default,ou=passwordPolicies,ads-directoryServiceId=default,ou=config
-objectClass: top
-objectClass: ads-base
-objectClass: ads-passwordPolicy
-ads-pwdId: default
-ads-pwdSafeModify: FALSE
-ads-pwdMaxAge: 0
-ads-pwdFailureCountInterval: 30
-ads-pwdAttribute: userPassword
-ads-pwdMaxFailure: 5
-ads-pwdLockout: TRUE
-ads-pwdMustChange: FALSE
-ads-pwdLockoutDuration: 0
-ads-pwdMinLength: 5
-ads-pwdInHistory: 5
-ads-pwdExpireWarning: 600
-ads-pwdMinAge: 0
-ads-pwdAllowUserChange: TRUE
-ads-pwdGraceAuthNLimit: 5
-ads-pwdCheckQuality: 2
-ads-enabled: TRUE
-
 dn: ou=partitions,ads-directoryServiceId=default,ou=config
 ou: partitions
 objectclass: organizationalUnit

Modified: directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java?rev=1096034&r1=1096033&r2=1096034&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
(original)
+++ directory/apacheds/trunk/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
Fri Apr 22 20:59:58 2011
@@ -27,8 +27,6 @@ import java.io.File;
 import java.util.List;
 
 import org.apache.commons.io.FileUtils;
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 import org.apache.directory.server.config.beans.ConfigBean;
 import org.apache.directory.server.config.beans.DirectoryServiceBean;
 import org.apache.directory.server.core.partition.ldif.SingleFileLdifPartition;
@@ -44,6 +42,9 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * Test class for ConfigPartitionReader
@@ -92,7 +93,6 @@ public class ConfigPartitionReaderTest
         {
             throw new Exception( "Schema load failed : " + Exceptions.printErrors(errors)
);
         }
-
     }
 
 

Modified: directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java?rev=1096034&r1=1096033&r2=1096034&view=diff
==============================================================================
--- directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
(original)
+++ directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
Fri Apr 22 20:59:58 2011
@@ -171,6 +171,29 @@ public class ServiceBuilder
                     Authenticator[] authenticators = createAuthenticators( ((AuthenticationInterceptorBean)interceptorBean).getAuthenticators()
);
                     ((AuthenticationInterceptor) interceptor).setAuthenticators( authenticators
);
                     
+                    // password policies
+                    List<PasswordPolicyBean> ppolicyBeans = ((AuthenticationInterceptorBean)interceptorBean).getPasswordPolicies();
+                    PpolicyConfigContainer ppolicyContainer = new  PpolicyConfigContainer();
+
+                    for ( PasswordPolicyBean ppolicyBean : ppolicyBeans )
+                    {
+                        PasswordPolicyConfiguration ppolicyConfig = createPwdPolicyConfig(
ppolicyBean );
+                        
+                        if ( ppolicyConfig != null )
+                        {
+                            // the name should be strictly 'default', the default policy
can't be enforced by defining a new AT
+                            if ( ppolicyBean.getPwdId().equalsIgnoreCase( "default" ) )
+                            {
+                                ppolicyContainer.setDefaultPolicy( ppolicyConfig );
+                            }
+                            else
+                            {
+                                ppolicyContainer.addPolicy( ppolicyBean.getDn(), ppolicyConfig
);
+                            }
+                        }
+
+                        ((AuthenticationInterceptorBean)interceptorBean).setPasswordPolicies(
ppolicyBeans );
+                    }
                 }
                 
                 interceptors.add( interceptor );
@@ -1264,37 +1287,15 @@ public class ServiceBuilder
         directoryService.setDenormalizeOpAttrsEnabled( directoryServiceBean.isDsDenormalizeOpAttrsEnabled()
);
         
         // Journal
-        Journal jl = createJournal( directoryServiceBean.getJournal() );
-        if ( jl != null )
-        {
-            directoryService.setJournal( jl );
-        }
+        Journal journal = createJournal( directoryServiceBean.getJournal() );
         
-        // password policies
-        List<PasswordPolicyBean> ppolicyBeans = directoryServiceBean.getPasswordPolicies();
-        PpolicyConfigContainer ppolicyContainer = new  PpolicyConfigContainer();
-
-        for ( PasswordPolicyBean ppolicyBean : ppolicyBeans )
+        if ( journal != null )
         {
-            PasswordPolicyConfiguration ppolicyConfig = createPwdPolicyConfig( ppolicyBean
);
-            
-            if ( ppolicyConfig != null )
-            {
-                // the name should be strictly 'default', the default policy can't be enforced
by defining a new AT
-                if ( ppolicyBean.getPwdId().equalsIgnoreCase( "default" ) )
-                {
-                    ppolicyContainer.setDefaultPolicy( ppolicyConfig );
-                }
-                else
-                {
-                    ppolicyContainer.addPolicy( ppolicyBean.getDn(), ppolicyConfig );
-                }
-            }
+            directoryService.setJournal( journal );
         }
         
         AuthenticationInterceptor authenticationInterceptor = (AuthenticationInterceptor)directoryService.getInterceptor(
AuthenticationInterceptor.class.getName() );
-        authenticationInterceptor.setPwdPolicies( ppolicyContainer );
-        
+
         // MaxPDUSize
         directoryService.setMaxPDUSize( directoryServiceBean.getDsMaxPDUSize() );
         



Mime
View raw message