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

119053 adavis: Merged 5.1.N (5.1.1) to 5.1-MC1 (5.1.0)
      117335 adavis: 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/HEAD/root@119891 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jean-Pierre Huynh
2015-12-10 09:59:04 +00:00
parent 133c8bf8ca
commit eda3bd18fc

View File

@@ -112,16 +112,12 @@ public class AuthenticationComponentImpl extends AbstractAuthenticationComponent
if (userDetails instanceof RepositoryAuthenticatedUser)
{
List<String> hashIndicator = ((RepositoryAuthenticatedUser)userDetails).getHashIndicator();
String preferredEncoding = passwordEncoder.getPreferredEncoding();
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
// 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
HashPasswordTransactionListener txListener = new HashPasswordTransactionListener(userName, password);