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/BRANCHES/DEV/5.1.N/root@117352 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-11-11 18:02:52 +00:00
parent d9211f4d13
commit e0f9b3e705

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)