You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2014/02/14 21:57:51 UTC

svn commit: r1568518 - /directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java

Author: kayyagari
Date: Fri Feb 14 20:57:50 2014
New Revision: 1568518

URL: http://svn.apache.org/r1568518
Log:
check if the password was hashed after modification

Modified:
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java?rev=1568518&r1=1568517&r2=1568518&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java (original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/extended/PwdModifyIT.java Fri Feb 14 20:57:50 2014
@@ -37,6 +37,7 @@ import org.apache.directory.api.ldap.ext
 import org.apache.directory.api.ldap.extras.extended.PwdModifyRequestImpl;
 import org.apache.directory.api.ldap.extras.extended.PwdModifyResponse;
 import org.apache.directory.api.ldap.model.constants.LdapSecurityConstants;
+import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.DefaultEntry;
 import org.apache.directory.api.ldap.model.entry.Entry;
@@ -60,6 +61,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration;
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
 import org.apache.directory.server.core.authn.ppolicy.PpolicyConfigContainer;
+import org.apache.directory.server.core.hash.Sha512PasswordHashingInterceptor;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.ldap.handlers.extended.PwdModifyHandler;
@@ -81,7 +83,7 @@ import org.junit.runner.RunWith;
         { PwdModifyHandler.class },
     allowAnonymousAccess = true)
 //disable changelog, for more info see DIRSERVER-1528
-@CreateDS(enableChangeLog = false, name = "PasswordPolicyTest")
+@CreateDS(enableChangeLog = false, name = "PasswordPolicyTest", additionalInterceptors = { Sha512PasswordHashingInterceptor.class })
 public class PwdModifyIT extends AbstractLdapTestUnit
 {
     private static final LdapApiService codec = LdapApiServiceFactory.getSingleton();
@@ -564,11 +566,15 @@ public class PwdModifyIT extends Abstrac
 
         // Now try to bind with the new password
         userConnection = getNetworkConnectionAs( ldapServer, "cn=User11,ou=system", "secret1Bis" );
+        userConnection.loadSchema();
 
-        Entry entry = userConnection.lookup( "cn=User11,ou=system" );
+        Entry entry = userConnection.lookup( "cn=User11,ou=system", SchemaConstants.ALL_ATTRIBUTES_ARRAY );
 
         assertNotNull( entry );
 
+        Attribute at = entry.get( SchemaConstants.USER_PASSWORD_AT );
+        assertEquals( LdapSecurityConstants.HASH_METHOD_SHA512, PasswordUtil.findAlgorithm( at.getBytes() ));
+        
         userConnection.close();
         adminConnection.close();
     }