directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1028420 - in /directory/apacheds/trunk: core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Date Thu, 28 Oct 2010 18:29:10 GMT
Author: kayyagari
Date: Thu Oct 28 18:29:10 2010
New Revision: 1028420

URL: http://svn.apache.org/viewvc?rev=1028420&view=rev
Log:
o fixed an NPE issue which can arise when the pwdpolicy is setting and the interceptor was
not yet intialized
o updated test case

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java?rev=1028420&r1=1028419&r2=1028420&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
Thu Oct 28 18:29:10 2010
@@ -32,9 +32,11 @@ import static org.junit.Assert.assertNul
 import static org.junit.Assert.assertTrue;
 
 import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.LdapNetworkConnection;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.PasswordPolicyConfiguration;
+import org.apache.directory.server.core.PpolicyConfigContainer;
 import org.apache.directory.server.core.annotations.CreateDS;
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
 import org.apache.directory.server.core.authn.PasswordUtil;
@@ -61,7 +63,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.control.Control;
 import org.apache.directory.shared.ldap.name.DN;
-import org.apache.directory.shared.ldap.util.StringTools;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -103,10 +104,13 @@ public class PasswordPolicyTest extends 
         policyConfig.setPwdGraceAuthNLimit( 5 );
         policyConfig.setPwdCheckQuality( 2 ); // DO NOT allow the password if its quality
can't be checked
 
+        PpolicyConfigContainer policyContainer = new PpolicyConfigContainer();
+        policyContainer.setDefaultPolicy( policyConfig );
+        service.setPwdPolicies( policyContainer );
+        
         AuthenticationInterceptor authInterceptor = ( AuthenticationInterceptor ) service
-            .getInterceptor( AuthenticationInterceptor.class.getName() );
-        authInterceptor.setPwdPolicyConfig( policyConfig );
-
+        .getInterceptor( AuthenticationInterceptor.class.getName() );
+        
         authInterceptor.loadPwdPolicyStateAtributeTypes();
     }
 
@@ -122,7 +126,7 @@ public class PasswordPolicyTest extends 
     public void testAddUserWithClearTextPwd() throws Exception
     {
         LdapConnection connection = getAdminNetworkConnection( ldapServer );
-
+        
         DN userDn = new DN( "cn=user,ou=system" );
         Entry userEntry = LdifUtils.createEntry( userDn, "ObjectClass: top", "ObjectClass:
person", "cn: user",
             "sn: user_sn", "userPassword: 1234" );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1028420&r1=1028419&r2=1028420&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Thu Oct 28 18:29:10 2010
@@ -158,7 +158,8 @@ public class AuthenticationInterceptor e
 
     private AttributeType AT_PWD_GRACE_USE_TIME;
 
-    
+    //FIXME should be removed after the config branch merge
+    private PpolicyConfigContainer policyContainer;
     
     /**
      * the set of interceptors we should *not* go through when pwdpolicy state information
is being updated
@@ -200,6 +201,8 @@ public class AuthenticationInterceptor e
     {
         this.directoryService = directoryService;
 
+        directoryService.setPwdPolicies( policyContainer );;
+        
         schemaManager = directoryService.getSchemaManager();
 
         adminSession = directoryService.getAdminSession();
@@ -1095,9 +1098,8 @@ public class AuthenticationInterceptor e
      */
     public void setPwdPolicyConfig( PasswordPolicyConfiguration policyConfig )
     {
-        PpolicyConfigContainer policyContainer = new PpolicyConfigContainer();
+        policyContainer = new PpolicyConfigContainer();
         policyContainer.setDefaultPolicy( policyConfig );
-        directoryService.setPwdPolicies( policyContainer );
     }
 
 



Mime
View raw message