You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2022/03/05 10:44:31 UTC
[syncope] branch master updated: [SYNCOPE-1666] Conditionally setting security answer value in linked accounts
This is an automated email from the ASF dual-hosted git repository.
ilgrosso 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 7491636 [SYNCOPE-1666] Conditionally setting security answer value in linked accounts
7491636 is described below
commit 7491636f0f7cea3341fc5942e91e152d29086ebc
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Sat Mar 5 11:38:26 2022 +0100
[SYNCOPE-1666] Conditionally setting security answer value in linked accounts
---
.../provisioning/java/data/UserDataBinderImpl.java | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 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 d5a8b36..879b454 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
@@ -74,7 +74,6 @@ import org.apache.syncope.core.persistence.api.entity.AccessToken;
import org.apache.syncope.core.persistence.api.entity.AnyUtils;
import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
import org.apache.syncope.core.persistence.api.entity.Delegation;
-import org.apache.syncope.core.persistence.api.entity.Entity;
import org.apache.syncope.core.persistence.api.entity.EntityFactory;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
import org.apache.syncope.core.persistence.api.entity.Privilege;
@@ -303,18 +302,15 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat
LinkedAccountTO accountTO = new LinkedAccountTO.Builder(
account.getKey(), account.getResource().getKey(), account.getConnObjectKeyValue()).
username(account.getUsername()).
- password(account.getPassword()).
+ password(returnPasswordValue ? account.getPassword() : null).
suspended(BooleanUtils.isTrue(account.isSuspended())).
build();
- account.getPlainAttrs().forEach(plainAttr -> {
- accountTO.getPlainAttrs().add(
- new Attr.Builder(plainAttr.getSchema().getKey()).
- values(plainAttr.getValuesAsStrings()).build());
- });
+ account.getPlainAttrs().forEach(plainAttr -> accountTO.getPlainAttrs().add(
+ new Attr.Builder(plainAttr.getSchema().getKey()).values(plainAttr.getValuesAsStrings()).build()));
accountTO.getPrivileges().addAll(account.getPrivileges().stream().
- map(Entity::getKey).collect(Collectors.toList()));
+ map(Privilege::getKey).collect(Collectors.toList()));
return accountTO;
}
@@ -829,15 +825,15 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat
if (details) {
// roles
- userTO.getRoles().addAll(user.getRoles().stream().map(Entity::getKey).collect(Collectors.toList()));
+ userTO.getRoles().addAll(user.getRoles().stream().map(Role::getKey).collect(Collectors.toList()));
// dynamic roles
userTO.getDynRoles().addAll(
- userDAO.findDynRoles(user.getKey()).stream().map(Entity::getKey).collect(Collectors.toList()));
+ userDAO.findDynRoles(user.getKey()).stream().map(Role::getKey).collect(Collectors.toList()));
// privileges
userTO.getPrivileges().addAll(userDAO.findAllRoles(user).stream().
- flatMap(role -> role.getPrivileges().stream()).map(Entity::getKey).collect(Collectors.toSet()));
+ flatMap(role -> role.getPrivileges().stream()).map(Privilege::getKey).collect(Collectors.toSet()));
// relationships
userTO.getRelationships().addAll(user.getRelationships().stream().