From 5c4577d74e39e8535ffc7ecbf505509f665acf2c Mon Sep 17 00:00:00 2001 From: Jean-Pierre Huynh Date: Thu, 10 Dec 2015 10:01:14 +0000 Subject: [PATCH] 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 --- .../security/authentication/AuthenticationTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/test-java/org/alfresco/repo/security/authentication/AuthenticationTest.java b/source/test-java/org/alfresco/repo/security/authentication/AuthenticationTest.java index fd7747f8c6..3982030765 100644 --- a/source/test-java/org/alfresco/repo/security/authentication/AuthenticationTest.java +++ b/source/test-java/org/alfresco/repo/security/authentication/AuthenticationTest.java @@ -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 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)