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 2019/12/06 09:11:26 UTC

[syncope] branch 2_1_X updated (f323d43 -> 9d746cb)

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

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


    from f323d43  [SYNCOPE-1522] Realm behaviors for Delegated Administration
     new e9523f0  [SYNCOPE-1518] More XForwardedRequestWrapperFactory config options
     new 9d746cb  White noise: more Java 8 goodness

The 2 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:
 .../client/console/SyncopeConsoleApplication.java  | 10 ++++++-
 .../client/console/panels/RealmChoicePanel.java    | 35 +++++++---------------
 2 files changed, 20 insertions(+), 25 deletions(-)


[syncope] 02/02: White noise: more Java 8 goodness

Posted by il...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit 9d746cbbaef513292a5e1be09535a59a6e3cdc51
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Fri Dec 6 10:11:11 2019 +0100

    White noise: more Java 8 goodness
---
 .../client/console/panels/RealmChoicePanel.java    | 35 +++++++---------------
 1 file changed, 11 insertions(+), 24 deletions(-)

diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
index 1c2b872..a20fbfd 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/RealmChoicePanel.java
@@ -37,8 +37,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import org.apache.commons.collections4.IterableUtils;
-import org.apache.commons.collections4.Predicate;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
@@ -95,10 +93,6 @@ public class RealmChoicePanel extends Panel {
         availableRealms = SyncopeConsoleSession.get().getAuthRealms();
         tree = new HashMap<>();
 
-        RealmTO fakeRootRealm = new RealmTO();
-        fakeRootRealm.setName(SyncopeConstants.ROOT_REALM);
-        fakeRootRealm.setFullPath(SyncopeConstants.ROOT_REALM);
-
         realmTree = new LoadableDetachableModel<List<Pair<String, RealmTO>>>() {
 
             private static final long serialVersionUID = -7688359318035249200L;
@@ -123,12 +117,9 @@ public class RealmChoicePanel extends Panel {
                 Map<String, Pair<RealmTO, List<RealmTO>>> map = reloadRealmParentMap();
                 List<Pair<String, RealmTO>> full = new ArrayList<>();
                 getChildren(full, null, map, StringUtils.EMPTY);
-
-                return full.stream().filter(realm
-                        -> availableRealms.stream().anyMatch(
-                                availableRealm -> realm.getValue().getFullPath()
-                                        .startsWith(availableRealm))).collect(Collectors.toList());
-
+                return full.stream().filter(realm -> availableRealms.stream().anyMatch(
+                        availableRealm -> realm.getValue().getFullPath().startsWith(availableRealm))).
+                        collect(Collectors.toList());
             }
         };
 
@@ -154,7 +145,7 @@ public class RealmChoicePanel extends Panel {
                                 || dynRealm.getKey().equals(availableRealm))).collect(Collectors.toList());
             }
         };
-       
+
         model = Model.of(realmTree.getObject().stream().findFirst().get().getValue());
         container = new WebMarkupContainer("container", realmTree);
         container.setOutputMarkupId(true);
@@ -213,13 +204,9 @@ public class RealmChoicePanel extends Panel {
                 @Override
                 public Pair<String, RealmTO> getObject(final String id,
                         final IModel<? extends List<? extends Pair<String, RealmTO>>> choices) {
-                    return IterableUtils.find(choices.getObject(), new Predicate<Pair<String, RealmTO>>() {
 
-                        @Override
-                        public boolean evaluate(final Pair<String, RealmTO> object) {
-                            return object.getKey().equals(id);
-                        }
-                    });
+                    return choices.getObject().stream().
+                            filter(object -> object.getKey().equals(id)).findFirst().orElse(null);
                 }
             });
             select.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
@@ -289,8 +276,8 @@ public class RealmChoicePanel extends Panel {
             }
         });
 
-        for (Pair<String, RealmTO> link : realmTree.getObject()) {
-            final RealmTO realmTO = link.getValue();
+        realmTree.getObject().forEach(link -> {
+            RealmTO realmTO = link.getValue();
             RealmChoicePanel.this.links.add(new BootstrapAjaxLink<RealmTO>(
                     ButtonList.getButtonMarkupId(),
                     Model.of(realmTO),
@@ -308,7 +295,7 @@ public class RealmChoicePanel extends Panel {
                     send(pageRef.getPage(), Broadcast.EXACT, new ChosenRealm<>(realmTO, target));
                 }
             });
-        }
+        });
 
         if (!dynRealmTree.getObject().isEmpty()) {
             RealmChoicePanel.this.links.add(new BootstrapAjaxLink<RealmTO>(
@@ -336,7 +323,7 @@ public class RealmChoicePanel extends Panel {
                 }
             });
 
-            for (DynRealmTO dynRealmTO : dynRealmTree.getObject()) {
+            dynRealmTree.getObject().forEach(dynRealmTO -> {
                 final RealmTO realmTO = new RealmTO();
                 realmTO.setKey(dynRealmTO.getKey());
                 realmTO.setName(dynRealmTO.getKey());
@@ -359,7 +346,7 @@ public class RealmChoicePanel extends Panel {
                         send(pageRef.getPage(), Broadcast.EXACT, new ChosenRealm<>(realmTO, target));
                     }
                 });
-            }
+            });
         }
     }
 


[syncope] 01/02: [SYNCOPE-1518] More XForwardedRequestWrapperFactory config options

Posted by il...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit e9523f0b495ebe4464f9f0825c334e1d901802bc
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Thu Dec 5 14:58:25 2019 +0100

    [SYNCOPE-1518] More XForwardedRequestWrapperFactory config options
---
 .../syncope/client/console/SyncopeConsoleApplication.java      | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java
index 641c9a0..94988c2 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.client.console;
 
+import com.google.common.net.HttpHeaders;
 import de.agilecoders.wicket.core.Bootstrap;
 import de.agilecoders.wicket.core.settings.BootstrapSettings;
 import de.agilecoders.wicket.core.settings.IBootstrapSettings;
@@ -211,7 +212,14 @@ public class SyncopeConsoleApplication extends AuthenticatedWebApplication {
         getMarkupSettings().setCompressWhitespace(true);
 
         if (BooleanUtils.toBoolean(props.getProperty("x-forward"))) {
-            getFilterFactoryManager().add(new XForwardedRequestWrapperFactory());
+            XForwardedRequestWrapperFactory.Config config = new XForwardedRequestWrapperFactory.Config();
+            config.setProtocolHeader(props.getProperty("x-forward.protocol.header", HttpHeaders.X_FORWARDED_PROTO));
+            config.setHttpServerPort(Integer.valueOf(props.getProperty("x-forward.http.port", "80")));
+            config.setHttpsServerPort(Integer.valueOf(props.getProperty("x-forward.https.port", "443")));
+
+            XForwardedRequestWrapperFactory factory = new XForwardedRequestWrapperFactory();
+            factory.setConfig(config);
+            getFilterFactoryManager().add(factory);
         }
 
         if (BooleanUtils.toBoolean(props.getProperty("csrf"))) {