Merged 5.1-MC1 (5.1.0) to HEAD (5.1)

119069 adavis: Merged 5.1.N (5.1.1) to 5.1-MC1 (5.1.0)
      117352 adavis: Merged 5.0.2-CLOUD42 (Cloud ) to 5.1.N (5.1.1)
         117259 adavis: Merged 5.0.2-CLOUD (Cloud ) to 5.0.2-CLOUD42 (Cloud )
            114532 adavis: Merged BCRYPT to 5.0.2-CLOUD
               114417 gjames: Test to confirm onpremise defaults to md4 for backwards compatibility MNT-14892,RA-599


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@119908 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jean-Pierre Huynh
2015-12-10 10:01:14 +00:00
parent 91e21c3bd6
commit 5c4577d74e

View File

@@ -1930,6 +1930,16 @@ public class AuthenticationTest extends TestCase
authenticationComponent.clearCurrentSecurityContext();
}
/**
* For on premise the default is MD4, for cloud BCRYPT10
*
* @throws Exception
*/
public void testDefaultEncodingIsMD4() throws Exception
{
assertNotNull(compositePasswordEncoder);
assertEquals("md4", compositePasswordEncoder.getPreferredEncoding());
}
/**
* Tests creating a user with a Hashed password
@@ -1937,6 +1947,7 @@ public class AuthenticationTest extends TestCase
public void testCreateUserWithHashedPassword() throws Exception
{
String SOME_PASSWORD = "1 passw0rd";
String defaultencoding = compositePasswordEncoder.getPreferredEncoding();
List<String> encs = Arrays.asList("bcrypt10", "md4");
for (String enc : encs)
{
@@ -1945,6 +1956,7 @@ public class AuthenticationTest extends TestCase
assertCreateHashed(SOME_PASSWORD, hash, null, "me@you.com");
assertCreateHashed(SOME_PASSWORD, null, SOME_PASSWORD.toCharArray(), "you@me.com");
}
compositePasswordEncoder.setPreferredEncoding(defaultencoding);
}
private void assertCreateHashed(String rawString, String hash, char[] rawPassword, String user)