Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 4811 invoked from network); 28 Oct 2010 18:30:07 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 28 Oct 2010 18:30:07 -0000 Received: (qmail 44995 invoked by uid 500); 28 Oct 2010 18:30:07 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 44959 invoked by uid 500); 28 Oct 2010 18:30:07 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 44952 invoked by uid 99); 28 Oct 2010 18:30:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Oct 2010 18:30:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Oct 2010 18:30:06 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 960522388A44; Thu, 28 Oct 2010 18:29:10 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: kayyagari@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101028182910.960522388A44@eris.apache.org> 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 ); }