Merged 5.0.2-CLOUD42 (Cloud ) to 5.1.N (5.1.1)

117243 adavis: Merged 5.0.2-CLOUD (Cloud ) to 5.0.2-CLOUD42 (Cloud )
      114512 adavis: Merged BCRYPT to 5.0.2-CLOUD (PARTIAL MERGE)
         113778 gcornwell: MNT-14892: Fixed tests


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@117335 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-11-11 17:50:27 +00:00
parent d916cc40dd
commit 4ef78ff58f

View File

@@ -112,16 +112,12 @@ public class AuthenticationComponentImpl extends AbstractAuthenticationComponent
if (userDetails instanceof RepositoryAuthenticatedUser) if (userDetails instanceof RepositoryAuthenticatedUser)
{ {
List<String> hashIndicator = ((RepositoryAuthenticatedUser)userDetails).getHashIndicator(); List<String> hashIndicator = ((RepositoryAuthenticatedUser)userDetails).getHashIndicator();
String preferredEncoding = passwordEncoder.getPreferredEncoding();
if (hashIndicator != null && !hashIndicator.isEmpty()) if (hashIndicator != null && !hashIndicator.isEmpty())
{ {
// get the last encoding in the chain
String currentEncoding = hashIndicator.get(hashIndicator.size()-1);
// if the encoding chain is longer than 1 (double hashed) or the // if the encoding chain is longer than 1 (double hashed) or the
// current encoding is not the preferred encoding then re-generate // current encoding is not the preferred encoding then re-generate
if (hashIndicator.size() > 1 || !currentEncoding.equals(preferredEncoding)) if (hashIndicator.size() > 1 || !passwordEncoder.lastEncodingIsPreferred(hashIndicator))
{ {
// add transaction listener to re-hash the users password // add transaction listener to re-hash the users password
HashPasswordTransactionListener txListener = new HashPasswordTransactionListener(userName, password); HashPasswordTransactionListener txListener = new HashPasswordTransactionListener(userName, password);