This is an automated email from the ASF dual-hosted git repository.

andreapatricelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/master by this push:
     new 7c856eb  [SYNCOPE-1666] linked account must have AES as encryption 
algorithm (#334)
7c856eb is described below

commit 7c856ebbfbd352cffda8bbfad737ad32840d74c9
Author: Andrea Patricelli <[email protected]>
AuthorDate: Thu Mar 31 16:14:13 2022 +0200

    [SYNCOPE-1666] linked account must have AES as encryption algorithm (#334)
---
 .../core/provisioning/java/data/UserDataBinderImpl.java       | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
 
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
index 0d4a345..393d5d3 100644
--- 
a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
+++ 
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
@@ -52,7 +52,6 @@ import 
org.apache.syncope.core.persistence.api.dao.AnyTypeClassDAO;
 import org.apache.syncope.core.persistence.api.dao.SecurityQuestionDAO;
 import org.apache.syncope.core.persistence.api.entity.group.Group;
 import org.apache.syncope.core.persistence.api.entity.resource.Item;
-import org.apache.syncope.core.persistence.api.entity.user.Account;
 import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion;
 import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.provisioning.api.PropagationByResource;
@@ -210,9 +209,9 @@ public class UserDataBinderImpl extends 
AbstractAnyDataBinder implements UserDat
         }
     }
 
-    private void setCipherAlgorithm(final Account account) {
-        if (account.getCipherAlgorithm() == null) {
-            
account.setCipherAlgorithm(CipherAlgorithm.valueOf(confParamOps.get(AuthContextUtils.getDomain(),
+    private void setCipherAlgorithm(final User user) {
+        if (user.getCipherAlgorithm() == null) {
+            
user.setCipherAlgorithm(CipherAlgorithm.valueOf(confParamOps.get(AuthContextUtils.getDomain(),
                     "password.cipher.algorithm", CipherAlgorithm.AES.name(), 
String.class)));
         }
     }
@@ -260,7 +259,9 @@ public class UserDataBinderImpl extends 
AbstractAnyDataBinder implements UserDat
             if (StringUtils.isBlank(accountTO.getPassword())) {
                 account.setEncodedPassword(null, null);
             } else if (!accountTO.getPassword().equals(account.getPassword())) 
{
-                setCipherAlgorithm(account);
+                if (account.getCipherAlgorithm() == null) {
+                    account.setCipherAlgorithm(CipherAlgorithm.AES);
+                }
                 account.setPassword(accountTO.getPassword());
             }
             account.setSuspended(accountTO.isSuspended());

Reply via email to