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 2018/03/30 10:22:44 UTC

syncope git commit: [SYNCOPE-956] Restoring 'pure' classNames behavior for SAML 2 SP ext

Repository: syncope
Updated Branches:
  refs/heads/master 837099618 -> 80083118c


[SYNCOPE-956] Restoring 'pure' classNames behavior for SAML 2 SP ext


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/80083118
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/80083118
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/80083118

Branch: refs/heads/master
Commit: 80083118c9bdd9f2e45803de16a5e21174474a9d
Parents: 8370996
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Mar 30 12:22:36 2018 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Mar 30 12:22:36 2018 +0200

----------------------------------------------------------------------
 .../console/wizards/SAML2IdPWizardBuilder.java  | 12 +++---
 .../panels/SAML2IdPsDirectoryPanel.properties   |  2 +-
 .../SAML2IdPsDirectoryPanel_it.properties       |  2 +-
 .../SAML2IdPsDirectoryPanel_pt_BR.properties    |  2 +-
 .../SAML2IdPsDirectoryPanel_ru.properties       |  2 +-
 .../syncope/common/lib/to/SAML2IdPTO.java       | 10 ++---
 .../core/logic/saml2/SAML2IdPEntity.java        |  4 +-
 .../core/logic/saml2/SAML2UserManager.java      | 28 +++++---------
 .../core/persistence/api/entity/SAML2IdP.java   |  4 +-
 .../persistence/jpa/entity/JPASAML2IdP.java     | 28 +++++---------
 .../java/data/SAML2IdPDataBinderImpl.java       | 40 +++++++-------------
 11 files changed, 50 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/80083118/ext/saml2sp/client-console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPWizardBuilder.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/client-console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPWizardBuilder.java b/ext/saml2sp/client-console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPWizardBuilder.java
index ebc7706..aa3dec5 100644
--- a/ext/saml2sp/client-console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPWizardBuilder.java
+++ b/ext/saml2sp/client-console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPWizardBuilder.java
@@ -110,7 +110,7 @@ public class SAML2IdPWizardBuilder extends AjaxWizardBuilder<SAML2IdPTO> {
             fields.add(createUnmatching);
 
             AjaxCheckBoxPanel selfRegUnmatching = new AjaxCheckBoxPanel(
-                    "field", "selfRegUnmatching", new PropertyModel<Boolean>(idpTO, "selfRegUnmatching"), false);
+                    "field", "selfRegUnmatching", new PropertyModel<>(idpTO, "selfRegUnmatching"), false);
             fields.add(selfRegUnmatching);
 
             AjaxCheckBoxPanel updateMatching = new AjaxCheckBoxPanel(
@@ -131,14 +131,14 @@ public class SAML2IdPWizardBuilder extends AjaxWizardBuilder<SAML2IdPTO> {
             bindingType.setChoices(Arrays.asList(SAML2BindingType.values()));
             fields.add(bindingType);
 
-            AjaxPalettePanel<String> actions = new AjaxPalettePanel.Builder<String>().
+            AjaxPalettePanel<String> actionsClassNames = new AjaxPalettePanel.Builder<String>().
                     setAllowMoveAll(true).setAllowOrder(true).
-                    setName(new StringResourceModel("actions", directoryPanel).getString()).
+                    setName(new StringResourceModel("actionsClassNames", directoryPanel).getString()).
                     build("field",
-                            new PropertyModel<List<String>>(idpTO, "actions"),
+                            new PropertyModel<>(idpTO, "actionsClassNames"),
                             new ListModel<>(actionsClasses.getObject()));
-            actions.setOutputMarkupId(true);
-            fields.add(actions);
+            actionsClassNames.setOutputMarkupId(true);
+            fields.add(actionsClassNames);
 
             add(new ListView<Component>("fields", fields) {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/80083118/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel.properties
----------------------------------------------------------------------
diff --git a/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel.properties b/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel.properties
index f9b8446..c2ecfe3 100644
--- a/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel.properties
+++ b/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel.properties
@@ -24,6 +24,6 @@ bindingType=Binding
 html.title=metadata
 createUnmatching=Create unmatching users
 updateMatching=Update matching users
-actions=Actions
+actionsClassNames=Actions
 template.title=user template
 selfRegUnmatching=SAML-initiated self-registration

http://git-wip-us.apache.org/repos/asf/syncope/blob/80083118/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_it.properties
----------------------------------------------------------------------
diff --git a/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_it.properties b/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_it.properties
index 955f671..bf8fa9e 100644
--- a/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_it.properties
+++ b/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_it.properties
@@ -24,6 +24,6 @@ bindingType=Binding
 html.title=metadata
 createUnmatching=Create unmatching users
 updateMatching=Update matching users
-actions=Azioni
+actionsClassNames=Azioni
 template.title=template utenti
 selfRegUnmatching=SAML-initiated self-registration

http://git-wip-us.apache.org/repos/asf/syncope/blob/80083118/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_pt_BR.properties b/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_pt_BR.properties
index 18ded60..4836116 100644
--- a/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_pt_BR.properties
+++ b/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_pt_BR.properties
@@ -24,6 +24,6 @@ bindingType=Binding
 html.title=metadata
 createUnmatching=Create unmatching users
 updateMatching=Update matching users
-actions=Actions
+actionsClassNames=Actions
 template.title=user template
 selfRegUnmatching=SAML-initiated self-registration

http://git-wip-us.apache.org/repos/asf/syncope/blob/80083118/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_ru.properties
----------------------------------------------------------------------
diff --git a/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_ru.properties b/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_ru.properties
index af158bd..f003174 100644
--- a/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_ru.properties
+++ b/ext/saml2sp/client-console/src/main/resources/org/apache/syncope/client/console/panels/SAML2IdPsDirectoryPanel_ru.properties
@@ -24,6 +24,6 @@ bindingType=Binding
 html.title=metadata
 createUnmatching=Create unmatching users
 updateMatching=Update matching users
-actions=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f
+actionsClassNames=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f
 template.title=user template
 selfRegUnmatching=SAML-initiated self-registration

http://git-wip-us.apache.org/repos/asf/syncope/blob/80083118/ext/saml2sp/common-lib/src/main/java/org/apache/syncope/common/lib/to/SAML2IdPTO.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/common-lib/src/main/java/org/apache/syncope/common/lib/to/SAML2IdPTO.java b/ext/saml2sp/common-lib/src/main/java/org/apache/syncope/common/lib/to/SAML2IdPTO.java
index 0c8a2d9..14fe76f 100644
--- a/ext/saml2sp/common-lib/src/main/java/org/apache/syncope/common/lib/to/SAML2IdPTO.java
+++ b/ext/saml2sp/common-lib/src/main/java/org/apache/syncope/common/lib/to/SAML2IdPTO.java
@@ -61,7 +61,7 @@ public class SAML2IdPTO extends AbstractBaseBean implements EntityTO, ItemContai
 
     private final List<ItemTO> items = new ArrayList<>();
 
-    private final List<String> actions = new ArrayList<>();
+    private final List<String> actionsClassNames = new ArrayList<>();
 
     @Override
     public String getKey() {
@@ -190,11 +190,11 @@ public class SAML2IdPTO extends AbstractBaseBean implements EntityTO, ItemContai
         return this.items.remove(item);
     }
 
-    @XmlElementWrapper(name = "actions")
-    @XmlElement(name = "action")
+    @XmlElementWrapper(name = "actionsClassNames")
+    @XmlElement(name = "actionsClassNames")
     @JsonProperty("actions")
-    public List<String> getActions() {
-        return actions;
+    public List<String> getActionsClassNames() {
+        return actionsClassNames;
     }
 
     public boolean isSupportUnsolicited() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/80083118/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2IdPEntity.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2IdPEntity.java b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2IdPEntity.java
index 7dff814..4318069 100644
--- a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2IdPEntity.java
+++ b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2IdPEntity.java
@@ -158,8 +158,8 @@ public class SAML2IdPEntity {
         return idpTO.getUserTemplate();
     }
 
-    public List<String> getActions() {
-        return idpTO.getActions();
+    public List<String> getActionsClassNames() {
+        return idpTO.getActionsClassNames();
     }
 
     public Endpoint getSSOLocation(final SAML2BindingType bindingType) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/80083118/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
index 9e16384..d3f763b 100644
--- a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
+++ b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
@@ -35,12 +35,10 @@ import org.apache.syncope.common.lib.to.SAML2LoginResponseTO;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
-import org.apache.syncope.core.persistence.api.dao.ImplementationDAO;
 import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
 import org.apache.syncope.core.persistence.api.dao.SAML2IdPDAO;
 import org.apache.syncope.core.persistence.api.dao.UserDAO;
 import org.apache.syncope.core.persistence.api.entity.EntityFactory;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
 import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
 import org.apache.syncope.core.persistence.api.entity.PlainSchema;
 import org.apache.syncope.core.persistence.api.entity.SAML2IdP;
@@ -78,9 +76,6 @@ public class SAML2UserManager {
     private PlainSchemaDAO plainSchemaDAO;
 
     @Autowired
-    private ImplementationDAO implementationDAO;
-
-    @Autowired
     private IntAttrNameParser intAttrNameParser;
 
     @Autowired
@@ -179,20 +174,15 @@ public class SAML2UserManager {
     private List<SAML2IdPActions> getActions(final SAML2IdPEntity idp) {
         List<SAML2IdPActions> actions = new ArrayList<>();
 
-        idp.getActions().forEach(key -> {
-            Implementation impl = implementationDAO.find(key);
-            if (impl == null) {
-                LOG.warn("Invalid implementation: {}", key);
-            } else {
-                try {
-                    Class<?> actionsClass = Class.forName(impl.getBody());
-                    SAML2IdPActions idpActions = (SAML2IdPActions) ApplicationContextProvider.getBeanFactory().
-                            createBean(actionsClass, AbstractBeanDefinition.AUTOWIRE_BY_TYPE, true);
-
-                    actions.add(idpActions);
-                } catch (Exception e) {
-                    LOG.warn("Class '{}' not found", impl.getBody(), e);
-                }
+        idp.getActionsClassNames().forEach(className -> {
+            try {
+                Class<?> actionsClass = Class.forName(className);
+                SAML2IdPActions idpActions = (SAML2IdPActions) ApplicationContextProvider.getBeanFactory().
+                        createBean(actionsClass, AbstractBeanDefinition.AUTOWIRE_BY_TYPE, true);
+
+                actions.add(idpActions);
+            } catch (Exception e) {
+                LOG.warn("Class '{}' not found", className, e);
             }
         });
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/80083118/ext/saml2sp/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/SAML2IdP.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/SAML2IdP.java b/ext/saml2sp/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/SAML2IdP.java
index fce4129..91bb69f 100644
--- a/ext/saml2sp/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/SAML2IdP.java
+++ b/ext/saml2sp/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/SAML2IdP.java
@@ -72,7 +72,5 @@ public interface SAML2IdP extends Entity {
 
     List<? extends SAML2IdPItem> getItems();
 
-    boolean add(Implementation action);
-
-    List<? extends Implementation> getActions();
+    List<String> getActionsClassNames();
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/80083118/ext/saml2sp/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2IdP.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2IdP.java b/ext/saml2sp/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2IdP.java
index b9bd2ad..2705f5e 100644
--- a/ext/saml2sp/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2IdP.java
+++ b/ext/saml2sp/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPASAML2IdP.java
@@ -24,22 +24,20 @@ import java.util.Optional;
 import javax.persistence.Basic;
 import javax.persistence.Cacheable;
 import javax.persistence.CascadeType;
+import javax.persistence.CollectionTable;
 import javax.persistence.Column;
+import javax.persistence.ElementCollection;
 import javax.persistence.Entity;
 import javax.persistence.FetchType;
 import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
 import javax.persistence.Lob;
-import javax.persistence.ManyToMany;
 import javax.persistence.OneToMany;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
 import org.apache.commons.lang3.ArrayUtils;
-import org.apache.syncope.common.lib.types.ImplementationType;
 import org.apache.syncope.common.lib.types.SAML2BindingType;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
 import org.apache.syncope.core.persistence.api.entity.SAML2IdP;
 import org.apache.syncope.core.persistence.api.entity.SAML2IdPItem;
 import org.apache.syncope.core.persistence.api.entity.SAML2UserTemplate;
@@ -99,13 +97,12 @@ public class JPASAML2IdP extends AbstractGeneratedKeyEntity implements SAML2IdP
     @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER, mappedBy = "idp")
     private JPASAML2UserTemplate userTemplate;
 
-    @ManyToMany(fetch = FetchType.EAGER)
-    @JoinTable(name = TABLE + "Action",
+    @ElementCollection(fetch = FetchType.EAGER)
+    @Column(name = "actionClassName")
+    @CollectionTable(name = TABLE + "_actionsClassNames",
             joinColumns =
-            @JoinColumn(name = "idp_id"),
-            inverseJoinColumns =
-            @JoinColumn(name = "implementation_id"))
-    private List<JPAImplementation> actions = new ArrayList<>();
+            @JoinColumn(name = "saml2IdP_id", referencedColumnName = "id"))
+    private List<String> actionsClassNames = new ArrayList<>();
 
     @Override
     public String getEntityID() {
@@ -231,14 +228,7 @@ public class JPASAML2IdP extends AbstractGeneratedKeyEntity implements SAML2IdP
     }
 
     @Override
-    public boolean add(final Implementation action) {
-        checkType(action, JPAImplementation.class);
-        checkImplementationType(action, ImplementationType.LOGIC_ACTIONS);
-        return this.actions.add((JPAImplementation) action);
-    }
-
-    @Override
-    public List<? extends Implementation> getActions() {
-        return actions;
+    public List<String> getActionsClassNames() {
+        return actionsClassNames;
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/80083118/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java
----------------------------------------------------------------------
diff --git a/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java b/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java
index b63928b..0d30a50 100644
--- a/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java
+++ b/ext/saml2sp/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/SAML2IdPDataBinderImpl.java
@@ -18,9 +18,9 @@
  */
 package org.apache.syncope.core.provisioning.java.data;
 
+import java.text.ParseException;
 import java.util.Base64;
 import java.util.stream.Collectors;
-import java.text.ParseException;
 import org.apache.syncope.common.lib.SyncopeClientCompositeException;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.AnyTypeClassTO;
@@ -32,13 +32,16 @@ import org.apache.syncope.common.lib.types.ClientExceptionType;
 import org.apache.syncope.common.lib.types.MappingPurpose;
 import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
-import org.apache.syncope.core.persistence.api.dao.ImplementationDAO;
 import org.apache.syncope.core.persistence.api.dao.SAML2IdPDAO;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
+import org.apache.syncope.core.persistence.api.entity.AnyTypeClass;
+import org.apache.syncope.core.persistence.api.entity.DerSchema;
+import org.apache.syncope.core.persistence.api.entity.Entity;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
 import org.apache.syncope.core.persistence.api.entity.SAML2EntityFactory;
 import org.apache.syncope.core.persistence.api.entity.SAML2IdP;
 import org.apache.syncope.core.persistence.api.entity.SAML2IdPItem;
 import org.apache.syncope.core.persistence.api.entity.SAML2UserTemplate;
+import org.apache.syncope.core.persistence.api.entity.VirSchema;
 import org.apache.syncope.core.provisioning.api.IntAttrName;
 import org.apache.syncope.core.provisioning.api.data.SAML2IdPDataBinder;
 import org.apache.syncope.core.provisioning.java.IntAttrNameParser;
@@ -63,9 +66,6 @@ public class SAML2IdPDataBinderImpl implements SAML2IdPDataBinder {
     private SAML2IdPDAO saml2IdPDAO;
 
     @Autowired
-    private ImplementationDAO implementationDAO;
-
-    @Autowired
     private SAML2EntityFactory entityFactory;
 
     @Autowired
@@ -201,32 +201,22 @@ public class SAML2IdPDataBinderImpl implements SAML2IdPDataBinder {
         AnyTypeClassTO allowedSchemas = new AnyTypeClassTO();
         anyTypeDAO.findUser().getClasses().forEach(anyTypeClass -> {
             allowedSchemas.getPlainSchemas().addAll(anyTypeClass.getPlainSchemas().stream().
-                    map(s -> s.getKey()).collect(Collectors.toList()));
+                    map(Entity::getKey).collect(Collectors.toList()));
             allowedSchemas.getDerSchemas().addAll(anyTypeClass.getDerSchemas().stream().
-                    map(s -> s.getKey()).collect(Collectors.toList()));
+                    map(Entity::getKey).collect(Collectors.toList()));
             allowedSchemas.getVirSchemas().addAll(anyTypeClass.getVirSchemas().stream().
-                    map(s -> s.getKey()).collect(Collectors.toList()));
+                    map(Entity::getKey).collect(Collectors.toList()));
         });
         populateItems(idpTO, idp, allowedSchemas);
 
-        idpTO.getActions().forEach(implementationKey -> {
-            Implementation implementation = implementationDAO.find(implementationKey);
-            if (implementation == null) {
-                LOG.debug("Invalid " + Implementation.class.getSimpleName() + "{}, ignoring...", implementationKey);
-            } else {
-                idp.add(implementation);
-            }
-        });
-        // remove all implementations not contained in the TO
-        idp.getActions().removeAll(idp.getActions().stream().
-                filter(implementation -> !idpTO.getActions().contains(implementation.getKey())).
-                collect(Collectors.toList()));
+        idp.getActionsClassNames().clear();
+        idp.getActionsClassNames().addAll(idpTO.getActionsClassNames());
 
         return saml2IdPDAO.save(idp);
     }
 
     private void populateItems(final SAML2IdP idp, final SAML2IdPTO idpTO) {
-        idp.getItems().forEach(item -> {
+        for (SAML2IdPItem item : idp.getItems()) {
             ItemTO itemTO = new ItemTO();
             itemTO.setKey(item.getKey());
             BeanUtils.copyProperties(item, itemTO, ITEM_IGNORE_PROPERTIES);
@@ -237,7 +227,7 @@ public class SAML2IdPDataBinderImpl implements SAML2IdPDataBinder {
             } else {
                 idpTO.add(itemTO);
             }
-        });
+        }
     }
 
     @Override
@@ -261,9 +251,7 @@ public class SAML2IdPDataBinderImpl implements SAML2IdPDataBinder {
 
         populateItems(idp, idpTO);
 
-        idp.getActions().forEach(action -> {
-            idpTO.getActions().add(action.getKey());
-        });
+        idpTO.getActionsClassNames().addAll(idp.getActionsClassNames());
 
         return idpTO;
     }