diff --git a/client/idm/console/src/main/resources/META-INF/resources/css/topology.scss b/client/idm/console/src/main/resources/META-INF/resources/css/topology.scss index 52674d114b..de890ca91c 100644 --- a/client/idm/console/src/main/resources/META-INF/resources/css/topology.scss +++ b/client/idm/console/src/main/resources/META-INF/resources/css/topology.scss @@ -32,7 +32,7 @@ #topology { position: relative; border: 0; - height: 780px; + height: calc(100vh - 175px); overflow: hidden; cursor: grab; } diff --git a/client/idm/console/src/main/resources/org/apache/syncope/client/console/topology/Topology.html b/client/idm/console/src/main/resources/org/apache/syncope/client/console/topology/Topology.html index 17ccca0022..d2ec3c78a5 100644 --- a/client/idm/console/src/main/resources/org/apache/syncope/client/console/topology/Topology.html +++ b/client/idm/console/src/main/resources/org/apache/syncope/client/console/topology/Topology.html @@ -40,7 +40,7 @@ -
+
[Actions]
diff --git a/core/idm/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java b/core/idm/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java index c0f6177c21..4678327172 100644 --- a/core/idm/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java +++ b/core/idm/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java @@ -33,6 +33,7 @@ import org.apache.syncope.common.lib.to.Provision; import org.apache.syncope.common.lib.to.ResourceTO; import org.apache.syncope.common.lib.types.ClientExceptionType; +import org.apache.syncope.common.lib.types.ConnConfProperty; import org.apache.syncope.common.lib.types.IdMEntitlement; import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO; import org.apache.syncope.core.persistence.api.dao.ConnInstanceDAO; @@ -423,6 +424,14 @@ public void check(final ResourceTO resourceTO) { ConnInstance connInstance = connInstanceDAO.findById(resourceTO.getConnector()). orElseThrow(() -> new NotFoundException("Connector " + resourceTO.getConnector())); + Optional.ofNullable(resourceTO.getKey()).flatMap(resourceDAO::findById). + ifPresent(externalResource -> { + Optional> newConfOverride = + ResourceDataBinder.newConf(externalResource.getConfOverride(), + resourceTO.getConfOverride()); + resourceTO.setConfOverride(newConfOverride); + }); + connectorManager.createConnector( connectorManager.buildConnInstanceOverride( connInstance, diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java index eb72ae70a6..e45cbaf2cd 100644 --- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java +++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java @@ -18,8 +18,13 @@ */ package org.apache.syncope.core.provisioning.api.data; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; import org.apache.syncope.common.lib.to.ResourceTO; +import org.apache.syncope.common.lib.types.ConnConfProperty; import org.apache.syncope.core.persistence.api.entity.ExternalResource; +import org.identityconnectors.common.security.GuardedString; public interface ResourceDataBinder { @@ -28,4 +33,48 @@ public interface ResourceDataBinder { ExternalResource create(ResourceTO resourceTO); ExternalResource update(ExternalResource resource, ResourceTO resourceTO); + + static Optional> newConf( + final Optional> previousConfOverride, + final Optional> toConfOverride) { + + if (toConfOverride.isEmpty()) { + return Optional.empty(); + } + + if (previousConfOverride.isEmpty()) { + return toConfOverride; + } + + List newConf = new ArrayList<>(); + + toConfOverride.get().forEach(property -> { + if (property.getSchema().isConfidential() + || GuardedString.class.getName().equals(property.getSchema().getType())) { + + if (property.getValues().isEmpty()) { + // no values provided, keep existing + previousConfOverride.get().stream(). + filter(p -> p.getSchema().getName().equals(property.getSchema().getName())). + findFirst().ifPresent(newConf::add); + } else { + // translate confidential properties' cleartext values into GuardedStrings + ConnConfProperty newProperty = new ConnConfProperty(); + newProperty.setSchema(property.getSchema()); + newProperty.setOverridable(property.isOverridable()); + property.getValues().forEach(value -> { + if (value instanceof String string) { + newProperty.getValues().add(new GuardedString(string.toCharArray())); + } else { + newProperty.getValues().add(value); + } + }); + } + } + + newConf.add(property); + }); + + return Optional.of(newConf); + } }