Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#topology {
position: relative;
border: 0;
height: 780px;
height: calc(100vh - 175px);
overflow: hidden;
cursor: grab;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<wicket:extend>
<span wicket:id="toggle"/>

<div id="zoom" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
<div id="zoom" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only pt-2 pe-2 pb-1">
<span wicket:id="zoom">[Actions]</span>
</div>
<div id="topology">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<List<ConnConfProperty>> newConfOverride =
ResourceDataBinder.newConf(externalResource.getConfOverride(),
resourceTO.getConfOverride());
resourceTO.setConfOverride(newConfOverride);
});

connectorManager.createConnector(
connectorManager.buildConnInstanceOverride(
connInstance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -28,4 +33,48 @@ public interface ResourceDataBinder {
ExternalResource create(ResourceTO resourceTO);

ExternalResource update(ExternalResource resource, ResourceTO resourceTO);

static Optional<List<ConnConfProperty>> newConf(
final Optional<List<ConnConfProperty>> previousConfOverride,
final Optional<List<ConnConfProperty>> toConfOverride) {

if (toConfOverride.isEmpty()) {
return Optional.empty();
}

if (previousConfOverride.isEmpty()) {
return toConfOverride;
}

List<ConnConfProperty> 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);
}
}
Loading