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 2023/02/24 10:42:00 UTC

[syncope] branch master updated (e9be8d2f00 -> 45b7ca1294)

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

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


    from e9be8d2f00 Switching to CXF 4.0.1-SNAPSHOT to avoid dependency conflicts with Spring Boot 3.0.3
     new b2c4d7a27c [SYNCOPE-1732] Moving labels
     new df0818aa20 [SYNCOPE-1735] Avoid using LoadableDetachableModel inside Spring beans
     new 45b7ca1294 More flexible assertions for SRA IT cases

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../clientapps/ClientAppModalPanelBuilder.java     | 13 +++---
 .../console/commons/AMRealmPolicyProvider.java     | 48 +++++-----------------
 .../policies/AccessPolicyModalPanel.properties     |  2 +
 .../policies/AccessPolicyModalPanel_fr.properties  |  2 +
 .../policies/AccessPolicyModalPanel_it.properties  |  2 +
 .../policies/AccessPolicyModalPanel_ja.properties  |  2 +
 .../AccessPolicyModalPanel_pt_BR.properties        |  2 +
 .../policies/AccessPolicyModalPanel_ru.properties  |  2 +
 .../wizards/resources/ResourceSecurityPanel.java   | 19 +++++----
 .../console/commons/IdRepoRealmPolicyProvider.java | 35 ++++------------
 .../wicket/markup/html/form/PolicyRenderer.java    |  7 ++--
 .../policies/PolicyDirectoryPanel.properties       |  6 ---
 .../policies/PolicyDirectoryPanel_fr_CA.properties |  6 ---
 .../policies/PolicyDirectoryPanel_it.properties    |  6 ---
 .../policies/PolicyDirectoryPanel_ja.properties    |  6 ---
 .../policies/PolicyDirectoryPanel_pt_BR.properties |  6 ---
 .../policies/PolicyDirectoryPanel_ru.properties    |  6 ---
 .../apache/syncope/fit/sra/AbstractSRAITCase.java  |  6 ++-
 .../org/apache/syncope/fit/sra/OIDCSRAITCase.java  |  6 ++-
 19 files changed, 59 insertions(+), 123 deletions(-)


[syncope] 02/03: [SYNCOPE-1735] Avoid using LoadableDetachableModel inside Spring beans

Posted by il...@apache.org.
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

commit df0818aa20e1ac821dd04db0d63348b439a9f5da
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Fri Feb 24 11:23:35 2023 +0100

    [SYNCOPE-1735] Avoid using LoadableDetachableModel inside Spring beans
---
 .../clientapps/ClientAppModalPanelBuilder.java     | 13 +++---
 .../console/commons/AMRealmPolicyProvider.java     | 48 +++++-----------------
 .../wizards/resources/ResourceSecurityPanel.java   | 19 +++++----
 .../console/commons/IdRepoRealmPolicyProvider.java | 35 ++++------------
 .../wicket/markup/html/form/PolicyRenderer.java    |  7 ++--
 5 files changed, 38 insertions(+), 84 deletions(-)

diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java
index bcc20e79cf..975a42d34e 100644
--- a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java
@@ -21,6 +21,7 @@ package org.apache.syncope.client.console.clientapps;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -84,7 +85,7 @@ public class ClientAppModalPanelBuilder<T extends ClientAppTO> extends AbstractM
         @Override
         protected Map<String, String> load() {
             return PolicyRestClient.list(PolicyType.ACCESS).stream().
-                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName));
+                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName, (v1, v2) -> v1, LinkedHashMap::new));
         }
     };
 
@@ -95,7 +96,7 @@ public class ClientAppModalPanelBuilder<T extends ClientAppTO> extends AbstractM
         @Override
         protected Map<String, String> load() {
             return PolicyRestClient.list(PolicyType.ATTR_RELEASE).stream().
-                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName));
+                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName, (v1, v2) -> v1, LinkedHashMap::new));
         }
     };
 
@@ -106,7 +107,7 @@ public class ClientAppModalPanelBuilder<T extends ClientAppTO> extends AbstractM
         @Override
         protected Map<String, String> load() {
             return PolicyRestClient.list(PolicyType.AUTH).stream().
-                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName));
+                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName, (v1, v2) -> v1, LinkedHashMap::new));
         }
     };
 
@@ -182,21 +183,21 @@ public class ClientAppModalPanelBuilder<T extends ClientAppTO> extends AbstractM
 
             AjaxDropDownChoicePanel<String> accessPolicy = new AjaxDropDownChoicePanel<>(
                     "field", "accessPolicy", new PropertyModel<>(clientAppTO, "accessPolicy"), false);
-            accessPolicy.setChoiceRenderer(new PolicyRenderer(accessPolicies));
+            accessPolicy.setChoiceRenderer(new PolicyRenderer(accessPolicies.getObject()));
             accessPolicy.setChoices(new ArrayList<>(accessPolicies.getObject().keySet()));
             ((AbstractSingleSelectChoice<?>) accessPolicy.getField()).setNullValid(true);
             fields.add(accessPolicy);
 
             AjaxDropDownChoicePanel<String> attrReleasePolicy = new AjaxDropDownChoicePanel<>(
                     "field", "attrReleasePolicy", new PropertyModel<>(clientAppTO, "attrReleasePolicy"), false);
-            attrReleasePolicy.setChoiceRenderer(new PolicyRenderer(attrReleasePolicies));
+            attrReleasePolicy.setChoiceRenderer(new PolicyRenderer(attrReleasePolicies.getObject()));
             attrReleasePolicy.setChoices(new ArrayList<>(attrReleasePolicies.getObject().keySet()));
             ((AbstractSingleSelectChoice<?>) attrReleasePolicy.getField()).setNullValid(true);
             fields.add(attrReleasePolicy);
 
             AjaxDropDownChoicePanel<String> authPolicy = new AjaxDropDownChoicePanel<>(
                     "field", "authPolicy", new PropertyModel<>(clientAppTO, "authPolicy"), false);
-            authPolicy.setChoiceRenderer(new PolicyRenderer(authPolicies));
+            authPolicy.setChoiceRenderer(new PolicyRenderer(authPolicies.getObject()));
             authPolicy.setChoices(new ArrayList<>(authPolicies.getObject().keySet()));
             authPolicy.setRequired(true);
             ((AbstractSingleSelectChoice<?>) authPolicy.getField()).setNullValid(true);
diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/commons/AMRealmPolicyProvider.java b/client/am/console/src/main/java/org/apache/syncope/client/console/commons/AMRealmPolicyProvider.java
index 174d03153d..bd358e2c47 100644
--- a/client/am/console/src/main/java/org/apache/syncope/client/console/commons/AMRealmPolicyProvider.java
+++ b/client/am/console/src/main/java/org/apache/syncope/client/console/commons/AMRealmPolicyProvider.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.client.console.commons;
 
 import java.util.ArrayList;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.stream.Collectors;
 import org.apache.syncope.client.console.rest.PolicyRestClient;
@@ -29,8 +30,6 @@ import org.apache.syncope.common.lib.to.RealmTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.wicket.markup.html.form.AbstractSingleSelectChoice;
 import org.apache.wicket.markup.repeater.RepeatingView;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
 import org.apache.wicket.model.PropertyModel;
 import org.apache.wicket.model.ResourceModel;
 
@@ -38,70 +37,43 @@ public class AMRealmPolicyProvider extends IdRepoRealmPolicyProvider {
 
     private static final long serialVersionUID = 1671878489700L;
 
-    private final IModel<Map<String, String>> accessPolicies = new LoadableDetachableModel<>() {
-
-        private static final long serialVersionUID = -2012833443695917883L;
-
-        @Override
-        protected Map<String, String> load() {
-            return PolicyRestClient.list(PolicyType.ACCESS).stream().
-                collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName));
-        }
-    };
-
-    private final IModel<Map<String, String>> attrReleasePolicies = new LoadableDetachableModel<>() {
-
-        private static final long serialVersionUID = -2012833443695917883L;
-
-        @Override
-        protected Map<String, String> load() {
-            return PolicyRestClient.list(PolicyType.ATTR_RELEASE).stream().
-                collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName));
-        }
-    };
-
-    private final IModel<Map<String, String>> authPolicies = new LoadableDetachableModel<>() {
-
-        private static final long serialVersionUID = -2012833443695917883L;
-
-        @Override
-        protected Map<String, String> load() {
-            return PolicyRestClient.list(PolicyType.AUTH).stream().
-                collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName));
-        }
-    };
-
     @Override
     public void add(final RealmTO realmTO, final RepeatingView view) {
         super.add(realmTO, view);
 
+        Map<String, String> accessPolicies = PolicyRestClient.list(PolicyType.ACCESS).stream().
+                collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName, (v1, v2) -> v1, LinkedHashMap::new));
         AjaxDropDownChoicePanel<String> accessPolicy = new AjaxDropDownChoicePanel<>(
                 view.newChildId(),
                 new ResourceModel("accessPolicy", "accessPolicy").getObject(),
                 new PropertyModel<>(realmTO, "accessPolicy"),
                 false);
         accessPolicy.setChoiceRenderer(new PolicyRenderer(accessPolicies));
-        accessPolicy.setChoices(new ArrayList<>(accessPolicies.getObject().keySet()));
+        accessPolicy.setChoices(new ArrayList<>(accessPolicies.keySet()));
         ((AbstractSingleSelectChoice<?>) accessPolicy.getField()).setNullValid(true);
         view.add(accessPolicy);
 
+        Map<String, String> attrReleasePolicies = PolicyRestClient.list(PolicyType.ATTR_RELEASE).stream().
+                collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName, (v1, v2) -> v1, LinkedHashMap::new));
         AjaxDropDownChoicePanel<String> attrReleasePolicy = new AjaxDropDownChoicePanel<>(
                 view.newChildId(),
                 new ResourceModel("attrReleasePolicy", "attrReleasePolicy").getObject(),
                 new PropertyModel<>(realmTO, "attrReleasePolicy"),
                 false);
         attrReleasePolicy.setChoiceRenderer(new PolicyRenderer(attrReleasePolicies));
-        attrReleasePolicy.setChoices(new ArrayList<>(attrReleasePolicies.getObject().keySet()));
+        attrReleasePolicy.setChoices(new ArrayList<>(attrReleasePolicies.keySet()));
         ((AbstractSingleSelectChoice<?>) attrReleasePolicy.getField()).setNullValid(true);
         view.add(attrReleasePolicy);
 
+        Map<String, String> authPolicies = PolicyRestClient.list(PolicyType.AUTH).stream().
+                collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName, (v1, v2) -> v1, LinkedHashMap::new));
         AjaxDropDownChoicePanel<String> authPolicy = new AjaxDropDownChoicePanel<>(
                 view.newChildId(),
                 new ResourceModel("authPolicy", "authPolicy").getObject(),
                 new PropertyModel<>(realmTO, "authPolicy"),
                 false);
         authPolicy.setChoiceRenderer(new PolicyRenderer(authPolicies));
-        authPolicy.setChoices(new ArrayList<>(authPolicies.getObject().keySet()));
+        authPolicy.setChoices(authPolicies.keySet().stream().collect(Collectors.toList()));
         ((AbstractSingleSelectChoice<?>) authPolicy.getField()).setNullValid(true);
         view.add(authPolicy);
     }
diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java
index ef9dae064f..ed1bf1753e 100644
--- a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java
+++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceSecurityPanel.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.client.console.wizards.resources;
 
 import java.util.ArrayList;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.stream.Collectors;
 import org.apache.syncope.client.console.rest.PolicyRestClient;
@@ -46,7 +47,7 @@ public class ResourceSecurityPanel extends WizardStep {
         @Override
         protected Map<String, String> load() {
             return PolicyRestClient.list(PolicyType.PASSWORD).stream().
-                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName));
+                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName, (v1, v2) -> v1, LinkedHashMap::new));
         }
     };
 
@@ -57,7 +58,7 @@ public class ResourceSecurityPanel extends WizardStep {
         @Override
         protected Map<String, String> load() {
             return PolicyRestClient.list(PolicyType.ACCOUNT).stream().
-                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName));
+                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName, (v1, v2) -> v1, LinkedHashMap::new));
         }
     };
 
@@ -68,7 +69,7 @@ public class ResourceSecurityPanel extends WizardStep {
         @Override
         protected Map<String, String> load() {
             return PolicyRestClient.list(PolicyType.PROPAGATION).stream().
-                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName));
+                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName, (v1, v2) -> v1, LinkedHashMap::new));
         }
     };
 
@@ -79,7 +80,7 @@ public class ResourceSecurityPanel extends WizardStep {
         @Override
         protected Map<String, String> load() {
             return PolicyRestClient.list(PolicyType.PULL).stream().
-                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName));
+                    collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName, (v1, v2) -> v1, LinkedHashMap::new));
         }
     };
 
@@ -111,7 +112,7 @@ public class ResourceSecurityPanel extends WizardStep {
                 new ResourceModel("passwordPolicy", "passwordPolicy").getObject(),
                 new PropertyModel<>(resourceTO, "passwordPolicy"),
                 false);
-        passwordPolicy.setChoiceRenderer(new PolicyRenderer(passwordPolicies));
+        passwordPolicy.setChoiceRenderer(new PolicyRenderer(passwordPolicies.getObject()));
         passwordPolicy.setChoices(new ArrayList<>(passwordPolicies.getObject().keySet()));
         ((DropDownChoice<?>) passwordPolicy.getField()).setNullValid(true);
         container.add(passwordPolicy);
@@ -125,7 +126,7 @@ public class ResourceSecurityPanel extends WizardStep {
                 new ResourceModel("accountPolicy", "accountPolicy").getObject(),
                 new PropertyModel<>(resourceTO, "accountPolicy"),
                 false);
-        accountPolicy.setChoiceRenderer(new PolicyRenderer(accountPolicies));
+        accountPolicy.setChoiceRenderer(new PolicyRenderer(accountPolicies.getObject()));
         accountPolicy.setChoices(new ArrayList<>(accountPolicies.getObject().keySet()));
         ((DropDownChoice<?>) accountPolicy.getField()).setNullValid(true);
         container.add(accountPolicy);
@@ -139,7 +140,7 @@ public class ResourceSecurityPanel extends WizardStep {
                 new ResourceModel("propagationPolicy", "propagationPolicy").getObject(),
                 new PropertyModel<>(resourceTO, "propagationPolicy"),
                 false);
-        propagationPolicy.setChoiceRenderer(new PolicyRenderer(propagationPolicies));
+        propagationPolicy.setChoiceRenderer(new PolicyRenderer(propagationPolicies.getObject()));
         propagationPolicy.setChoices(new ArrayList<>(propagationPolicies.getObject().keySet()));
         ((DropDownChoice<?>) propagationPolicy.getField()).setNullValid(true);
         container.add(propagationPolicy);
@@ -153,7 +154,7 @@ public class ResourceSecurityPanel extends WizardStep {
                 new ResourceModel("pullPolicy", "pullPolicy").getObject(),
                 new PropertyModel<>(resourceTO, "pullPolicy"),
                 false);
-        pullPolicy.setChoiceRenderer(new PolicyRenderer(pullPolicies));
+        pullPolicy.setChoiceRenderer(new PolicyRenderer(pullPolicies.getObject()));
         pullPolicy.setChoices(new ArrayList<>(pullPolicies.getObject().keySet()));
         ((DropDownChoice<?>) pullPolicy.getField()).setNullValid(true);
         container.add(pullPolicy);
@@ -167,7 +168,7 @@ public class ResourceSecurityPanel extends WizardStep {
                 new ResourceModel("pushPolicy", "pushPolicy").getObject(),
                 new PropertyModel<>(resourceTO, "pushPolicy"),
                 false);
-        pushPolicy.setChoiceRenderer(new PolicyRenderer(pushPolicies));
+        pushPolicy.setChoiceRenderer(new PolicyRenderer(pushPolicies.getObject()));
         pushPolicy.setChoices(new ArrayList<>(pushPolicies.getObject().keySet()));
         ((DropDownChoice<?>) pushPolicy.getField()).setNullValid(true);
         container.add(pushPolicy);
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/commons/IdRepoRealmPolicyProvider.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/commons/IdRepoRealmPolicyProvider.java
index 1e6737043b..c983e030e4 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/commons/IdRepoRealmPolicyProvider.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/commons/IdRepoRealmPolicyProvider.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.client.console.commons;
 
 import java.util.ArrayList;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.stream.Collectors;
 import org.apache.syncope.client.console.rest.PolicyRestClient;
@@ -29,56 +30,36 @@ import org.apache.syncope.common.lib.to.RealmTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.wicket.markup.html.form.AbstractSingleSelectChoice;
 import org.apache.wicket.markup.repeater.RepeatingView;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
 import org.apache.wicket.model.PropertyModel;
 import org.apache.wicket.model.ResourceModel;
 
 public class IdRepoRealmPolicyProvider implements RealmPolicyProvider {
 
-    private static final long serialVersionUID = 1L;
-
-    private final IModel<Map<String, String>> accountPolicies = new LoadableDetachableModel<>() {
-
-        private static final long serialVersionUID = -2012833443695917883L;
-
-        @Override
-        protected Map<String, String> load() {
-            return PolicyRestClient.list(PolicyType.ACCOUNT).stream().
-                collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName));
-        }
-    };
-
-    private final IModel<Map<String, String>> passwordPolicies = new LoadableDetachableModel<>() {
-
-        private static final long serialVersionUID = -2012833443695917883L;
-
-        @Override
-        protected Map<String, String> load() {
-            return PolicyRestClient.list(PolicyType.PASSWORD).stream().
-                collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName));
-        }
-    };
+    private static final long serialVersionUID = 2933826125264961282L;
 
     @Override
     public void add(final RealmTO realmTO, final RepeatingView view) {
+        Map<String, String> accountPolicies = PolicyRestClient.list(PolicyType.ACCOUNT).stream().
+                collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName, (v1, v2) -> v1, LinkedHashMap::new));
         AjaxDropDownChoicePanel<String> accountPolicy = new AjaxDropDownChoicePanel<>(
                 view.newChildId(),
                 new ResourceModel("accountPolicy", "accountPolicy").getObject(),
                 new PropertyModel<>(realmTO, "accountPolicy"),
                 false);
         accountPolicy.setChoiceRenderer(new PolicyRenderer(accountPolicies));
-        accountPolicy.setChoices(new ArrayList<>(accountPolicies.getObject().keySet()));
+        accountPolicy.setChoices(new ArrayList<>(accountPolicies.keySet()));
         ((AbstractSingleSelectChoice<?>) accountPolicy.getField()).setNullValid(true);
         view.add(accountPolicy);
 
+        Map<String, String> passwordPolicies = PolicyRestClient.list(PolicyType.PASSWORD).stream().
+                collect(Collectors.toMap(PolicyTO::getKey, PolicyTO::getName, (v1, v2) -> v1, LinkedHashMap::new));
         AjaxDropDownChoicePanel<String> passwordPolicy = new AjaxDropDownChoicePanel<>(
                 view.newChildId(),
                 new ResourceModel("passwordPolicy", "passwordPolicy").getObject(),
                 new PropertyModel<>(realmTO, "passwordPolicy"),
                 false);
         passwordPolicy.setChoiceRenderer(new PolicyRenderer(passwordPolicies));
-        passwordPolicy.setChoices(new ArrayList<>(passwordPolicies.getObject().keySet()));
+        passwordPolicy.setChoices(new ArrayList<>(passwordPolicies.keySet()));
         ((AbstractSingleSelectChoice<?>) passwordPolicy.getField()).setNullValid(true);
         view.add(passwordPolicy);
     }
diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/PolicyRenderer.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/PolicyRenderer.java
index 2b05c1b1e3..3d560b5967 100644
--- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/PolicyRenderer.java
+++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/PolicyRenderer.java
@@ -20,22 +20,21 @@ package org.apache.syncope.client.console.wicket.markup.html.form;
 
 import java.util.Map;
 import org.apache.wicket.markup.html.form.ChoiceRenderer;
-import org.apache.wicket.model.IModel;
 
 public class PolicyRenderer extends ChoiceRenderer<String> {
 
     private static final long serialVersionUID = 8060500161321947000L;
 
-    private final IModel<Map<String, String>> policies;
+    private final Map<String, String> policies;
 
-    public PolicyRenderer(final IModel<Map<String, String>> policies) {
+    public PolicyRenderer(final Map<String, String> policies) {
         super();
         this.policies = policies;
     }
 
     @Override
     public Object getDisplayValue(final String object) {
-        return policies.getObject().get(object);
+        return policies.get(object);
     }
 
     @Override


[syncope] 03/03: More flexible assertions for SRA IT cases

Posted by il...@apache.org.
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

commit 45b7ca129493efc99b0db6be614b0f9e38510e38
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Fri Feb 24 11:41:52 2023 +0100

    More flexible assertions for SRA IT cases
---
 .../src/test/java/org/apache/syncope/fit/sra/AbstractSRAITCase.java | 6 ++++--
 .../src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java     | 6 +++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/AbstractSRAITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/AbstractSRAITCase.java
index 6fc4f7248a..0b7beafbff 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/AbstractSRAITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/AbstractSRAITCase.java
@@ -19,6 +19,9 @@
 package org.apache.syncope.fit.sra;
 
 import static org.awaitility.Awaitility.await;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.oneOf;
 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -258,8 +261,7 @@ public abstract class AbstractSRAITCase extends AbstractITCase {
 
         ObjectNode headers = (ObjectNode) json.get("headers");
         assertEquals(MediaType.TEXT_HTML, headers.get(HttpHeaders.ACCEPT).asText());
-        assertEquals(EN_LANGUAGE, headers.get(HttpHeaders.ACCEPT_LANGUAGE).asText());
-        assertEquals("localhost:" + PORT, headers.get("X-Forwarded-Host").asText());
+        assertThat(headers.get("X-Forwarded-Host").asText(), is(oneOf("localhost:" + PORT, "127.0.0.1:" + PORT)));
 
         assertEquals(
                 StringUtils.substringBefore(originalRequestURI, "?"),
diff --git a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java
index d4b92faf55..fb27f5ef09 100644
--- a/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java
+++ b/fit/wa-reference/src/test/java/org/apache/syncope/fit/sra/OIDCSRAITCase.java
@@ -18,6 +18,10 @@
  */
 package org.apache.syncope.fit.sra;
 
+import static org.apache.syncope.fit.sra.AbstractSRAITCase.PORT;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.oneOf;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -271,7 +275,7 @@ public class OIDCSRAITCase extends AbstractSRAITCase {
         ObjectNode headers = (ObjectNode) json.get("headers");
         assertEquals(MediaType.APPLICATION_JSON, headers.get(HttpHeaders.ACCEPT).asText());
         assertEquals(MediaType.APPLICATION_JSON, headers.get(HttpHeaders.CONTENT_TYPE).asText());
-        assertEquals("localhost:" + PORT, headers.get("X-Forwarded-Host").asText());
+        assertThat(headers.get("X-Forwarded-Host").asText(), is(oneOf("localhost:" + PORT, "127.0.0.1:" + PORT)));
 
         assertEquals(client.getBaseURI().toASCIIString().replace("/protected", ""), json.get("url").asText());
     }


[syncope] 01/03: [SYNCOPE-1732] Moving labels

Posted by il...@apache.org.
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

commit b2c4d7a27c474d0ddb1fa4b8d1449338be872e04
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Fri Feb 24 10:41:32 2023 +0100

    [SYNCOPE-1732] Moving labels
---
 .../client/console/policies/AccessPolicyModalPanel.properties       | 2 ++
 .../client/console/policies/AccessPolicyModalPanel_fr.properties    | 2 ++
 .../client/console/policies/AccessPolicyModalPanel_it.properties    | 2 ++
 .../client/console/policies/AccessPolicyModalPanel_ja.properties    | 2 ++
 .../client/console/policies/AccessPolicyModalPanel_pt_BR.properties | 2 ++
 .../client/console/policies/AccessPolicyModalPanel_ru.properties    | 2 ++
 .../syncope/client/console/policies/PolicyDirectoryPanel.properties | 6 ------
 .../client/console/policies/PolicyDirectoryPanel_fr_CA.properties   | 6 ------
 .../client/console/policies/PolicyDirectoryPanel_it.properties      | 6 ------
 .../client/console/policies/PolicyDirectoryPanel_ja.properties      | 6 ------
 .../client/console/policies/PolicyDirectoryPanel_pt_BR.properties   | 6 ------
 .../client/console/policies/PolicyDirectoryPanel_ru.properties      | 6 ------
 12 files changed, 12 insertions(+), 36 deletions(-)

diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel.properties
index a3d82caf88..33143bb412 100644
--- a/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel.properties
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel.properties
@@ -25,3 +25,5 @@ endpointUrl=Endpoint URL
 start=Start
 end=End
 zoneId=Zone Id
+requiredAttrs=Required Attributes
+rejectedAttrs=Rejected Attributes
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_fr.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_fr.properties
index a3d82caf88..33143bb412 100644
--- a/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_fr.properties
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_fr.properties
@@ -25,3 +25,5 @@ endpointUrl=Endpoint URL
 start=Start
 end=End
 zoneId=Zone Id
+requiredAttrs=Required Attributes
+rejectedAttrs=Rejected Attributes
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_it.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_it.properties
index e5acdd4de1..7801c64fb8 100644
--- a/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_it.properties
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_it.properties
@@ -25,3 +25,5 @@ endpointUrl=URL Endpoint
 start=Inizio
 end=Fine
 zoneId=Zone Id
+requiredAttrs=Attibuti Richiesti
+rejectedAttrs=Attributi Rifiutati
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_ja.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_ja.properties
index a3d82caf88..33143bb412 100644
--- a/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_ja.properties
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_ja.properties
@@ -25,3 +25,5 @@ endpointUrl=Endpoint URL
 start=Start
 end=End
 zoneId=Zone Id
+requiredAttrs=Required Attributes
+rejectedAttrs=Rejected Attributes
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_pt_BR.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_pt_BR.properties
index a3d82caf88..33143bb412 100644
--- a/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_pt_BR.properties
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_pt_BR.properties
@@ -25,3 +25,5 @@ endpointUrl=Endpoint URL
 start=Start
 end=End
 zoneId=Zone Id
+requiredAttrs=Required Attributes
+rejectedAttrs=Rejected Attributes
diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_ru.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_ru.properties
index a3d82caf88..33143bb412 100644
--- a/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_ru.properties
+++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/policies/AccessPolicyModalPanel_ru.properties
@@ -25,3 +25,5 @@ endpointUrl=Endpoint URL
 start=Start
 end=End
 zoneId=Zone Id
+requiredAttrs=Required Attributes
+rejectedAttrs=Rejected Attributes
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.properties
index d3ba8cea8d..8db5446b72 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel.properties
@@ -32,11 +32,6 @@ conflictResolutionAction=Conflict Resolution Action
 enabled=Enabled
 change_view.title=configuration
 change_view.class=fa fa-expand
-requiredAttrs.title=Required Attributes
-type_extensions.title=required attributes
-type_extensions.class=fas fa-check-circle
-claim.title=rejected attributes
-claim.class=far fa-check-circle
 status=Attribute Consent
 allowedAttrs=Allowed Attributes
 excludedAttrs=Excluded Attributes
@@ -46,7 +41,6 @@ authPolicyConf.title=Authentication Configuration
 tryAll=Try All
 authModules=Authentication Modules
 order=Order
-rejectedAttrs.title=Rejected Attributes
 unauthorizedRedirectUrl=Unauthorized Redirect URL
 maxAttempts=Max Attempts
 backOffStrategy=BackOff Strategy
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_fr_CA.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_fr_CA.properties
index ef600f1ff2..edf43897f9 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_fr_CA.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_fr_CA.properties
@@ -32,11 +32,6 @@ conflictResolutionAction=Action de r\u00e9solution des conflits
 enabled=Enabled
 change_view.title=configuration
 change_view.class=fa fa-expand
-requiredAttrs.title=Required Attributes
-type_extensions.title=required attributes
-type_extensions.class=fas fa-check-circle
-claim.title=rejected attributes
-claim.class=far fa-check-circle
 status=Attribute Consent
 allowedAttrs=Allowed Attributes
 excludedAttrs=Excluded Attributes
@@ -46,7 +41,6 @@ authPolicyConf.title=Authentication Configuration
 tryAll=Try All
 authModules=Authentication Modules
 order=Order
-rejectedAttrs.title=Rejected Attributes
 unauthorizedRedirectUrl=Unauthorized Redirect URL
 maxAttempts=Max Attempts
 backOffStrategy=BackOff Strategy
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_it.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_it.properties
index a7d05a668d..3f3b8a2c31 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_it.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_it.properties
@@ -32,11 +32,6 @@ conflictResolutionAction=Azione di Risoluzione Conflitti
 enabled=Abilitata
 change_view.title=configurazione
 change_view.class=fa fa-expand
-requiredAttrs.title=Attributi Richiesti
-type_extensions.title=attributi richiesti
-type_extensions.class=fas fa-check-circle
-claim.title=attributi rifiutati
-claim.class=far fa-check-circle
 status=Consenso Attributi
 allowedAttrs=Attributi Consentiti
 excludedAttrs=Attributi Esclusi
@@ -46,7 +41,6 @@ authPolicyConf.title=Configurazione Autenticazione
 tryAll=Prova Tutti
 authModules=Moduli di Authenticazione
 order=Ordinamento
-rejectedAttrs.title=Attributi Rifiutati
 unauthorizedRedirectUrl=URL di Ridirezione Per Mancata Autorizzazione
 maxAttempts=Tentativi Massimi
 backOffStrategy=Strategia di BackOff
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_ja.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_ja.properties
index 2a5e1ad609..5ac2d6e170 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_ja.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_ja.properties
@@ -32,11 +32,6 @@ conflictResolutionAction=\u7af6\u5408\u89e3\u6c7a\u30a2\u30af\u30b7\u30e7\u30f3
 enabled=Enabled
 change_view.title=configuration
 change_view.class=fa fa-expand
-requiredAttrs.title=Required Attributes
-type_extensions.title=required attributes
-type_extensions.class=fas fa-check-circle
-claim.title=rejected attributes
-claim.class=far fa-check-circle
 status=Attribute Consent
 allowedAttrs=Allowed Attributes
 excludedAttrs=Excluded Attributes
@@ -46,7 +41,6 @@ authPolicyConf.title=Authentication Configuration
 tryAll=Try All
 authModules=Authentication Modules
 order=Order
-rejectedAttrs.title=Rejected Attributes
 unauthorizedRedirectUrl=Unauthorized Redirect URL
 maxAttempts=Max Attempts
 backOffStrategy=BackOff Strategy
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_pt_BR.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_pt_BR.properties
index 3cfc47de41..e12adf4376 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_pt_BR.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_pt_BR.properties
@@ -32,11 +32,6 @@ conflictResolutionAction=Conflict Resolution Action
 enabled=Enabled
 change_view.title=configuration
 change_view.class=fa fa-expand
-requiredAttrs.title=Required Attributes
-type_extensions.title=required attributes
-type_extensions.class=fas fa-check-circle
-claim.title=rejected attributes
-claim.class=far fa-check-circle
 status=Attribute Consent
 allowedAttrs=Allowed Attributes
 excludedAttrs=Excluded Attributes
@@ -46,7 +41,6 @@ authPolicyConf.title=Authentication Configuration
 tryAll=Try All
 authModules=Authentication Modules
 order=Order
-rejectedAttrs.title=Rejected Attributes
 unauthorizedRedirectUrl=Unauthorized Redirect URL
 maxAttempts=Max Attempts
 backOffStrategy=BackOff Strategy
diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_ru.properties b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_ru.properties
index 9bc0f705f6..c8a3c08e24 100644
--- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_ru.properties
+++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/policies/PolicyDirectoryPanel_ru.properties
@@ -33,11 +33,6 @@ conflictResolutionAction=Conflict Resolution Action
 enabled=Enabled
 change_view.title=configuration
 change_view.class=fa fa-expand
-requiredAttrs.title=Required Attributes
-type_extensions.title=required attributes
-type_extensions.class=fas fa-check-circle
-claim.title=rejected attributes
-claim.class=far fa-check-circle
 status=Attribute Consent
 allowedAttrs=Allowed Attributes
 excludedAttrs=Excluded Attributes
@@ -47,7 +42,6 @@ authPolicyConf.title=Authentication Configuration
 tryAll=Try All
 authModules=Authentication Modules
 order=Order
-rejectedAttrs.title=Rejected Attributes
 unauthorizedRedirectUrl=Unauthorized Redirect URL
 maxAttempts=Max Attempts
 backOffStrategy=BackOff Strategy