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/11/26 10:46:47 UTC

[syncope] branch 2_0_X updated: [SYNCOPE-1518] Conditionally enabling Wicket's XForwardedRequestWrapperFactory

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

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


The following commit(s) were added to refs/heads/2_0_X by this push:
     new 4d5fff2  [SYNCOPE-1518] Conditionally enabling Wicket's XForwardedRequestWrapperFactory
4d5fff2 is described below

commit 4d5fff27f2cb2758009d1a0404f90f8609669101
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Tue Nov 26 11:29:21 2019 +0100

    [SYNCOPE-1518] Conditionally enabling Wicket's XForwardedRequestWrapperFactory
---
 .../apache/syncope/client/console/SyncopeConsoleApplication.java | 9 ++++++---
 client/console/src/main/resources/console.properties             | 1 +
 docker/console/src/main/resources/console.properties.template    | 5 +++++
 fit/console-reference/src/main/resources/console.properties      | 1 +
 fit/core-reference/src/test/resources/console.properties         | 2 +-
 5 files changed, 14 insertions(+), 4 deletions(-)

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 054bf28..f353a4c 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
@@ -61,6 +61,7 @@ import org.apache.wicket.authroles.authentication.AuthenticatedWebSession;
 import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
 import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.http.servlet.XForwardedRequestWrapperFactory;
 import org.apache.wicket.protocol.ws.WebSocketAwareCsrfPreventionRequestCycleListener;
 import org.apache.wicket.protocol.ws.api.WebSocketResponse;
 import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
@@ -176,8 +177,6 @@ public class SyncopeConsoleApplication extends AuthenticatedWebApplication {
         maxPoolSize = Integer.valueOf(props.getProperty("topology.maxPoolSize", "10"));
         queueCapacity = Integer.valueOf(props.getProperty("topology.queueCapacity", "50"));
 
-        String csrf = props.getProperty("csrf");
-
         // process page properties
         pageClasses = new HashMap<>();
         populatePageClasses(props);
@@ -209,7 +208,11 @@ public class SyncopeConsoleApplication extends AuthenticatedWebApplication {
         getMarkupSettings().setStripWicketTags(true);
         getMarkupSettings().setCompressWhitespace(true);
 
-        if (BooleanUtils.toBoolean(csrf)) {
+        if (BooleanUtils.toBoolean(props.getProperty("x-forward"))) {
+            getFilterFactoryManager().add(new XForwardedRequestWrapperFactory());
+        }
+
+        if (BooleanUtils.toBoolean(props.getProperty("csrf"))) {
             getRequestCycleListeners().add(new WebSocketAwareCsrfPreventionRequestCycleListener());
         }
         getRequestCycleListeners().add(new SyncopeConsoleRequestCycleListener());
diff --git a/client/console/src/main/resources/console.properties b/client/console/src/main/resources/console.properties
index 64942b1..33568f8 100644
--- a/client/console/src/main/resources/console.properties
+++ b/client/console/src/main/resources/console.properties
@@ -29,6 +29,7 @@ maxUploadFileSizeMB=5
 # Max wait time on apply changes from modals/wizards (given in seconds)
 maxWaitTimeOnApplyChanges=30
 
+x-forward=true
 csrf=true
 
 activitiModelerDirectory=${activiti-modeler.directory}
diff --git a/docker/console/src/main/resources/console.properties.template b/docker/console/src/main/resources/console.properties.template
index 4fb02ac..3b6e272 100644
--- a/docker/console/src/main/resources/console.properties.template
+++ b/docker/console/src/main/resources/console.properties.template
@@ -31,6 +31,7 @@ maxUploadFileSizeMB=5
 # Max wait time on apply changes from modals/wizards (given in seconds)
 maxWaitTimeOnApplyChanges=30
 
+x-forward=true
 csrf=true
 
 activitiModelerDirectory=/etc/apache-syncope/activiti-modeler
@@ -51,3 +52,7 @@ page.types=org.apache.syncope.client.console.pages.Types
 page.policies=org.apache.syncope.client.console.pages.Policies
 page.notifications=org.apache.syncope.client.console.pages.Notifications
 page.parameters=org.apache.syncope.client.console.pages.Parameters
+
+topology.corePoolSize=10
+topology.maxPoolSize=20
+topology.queueCapacity=50
diff --git a/fit/console-reference/src/main/resources/console.properties b/fit/console-reference/src/main/resources/console.properties
index edec417..8f64da2 100644
--- a/fit/console-reference/src/main/resources/console.properties
+++ b/fit/console-reference/src/main/resources/console.properties
@@ -29,6 +29,7 @@ maxUploadFileSizeMB=5
 # Max wait time on apply changes from modals/wizards (given in seconds)
 maxWaitTimeOnApplyChanges=30
 
+x-forward=true
 csrf=true
 
 activitiModelerDirectory=${activiti-modeler.directory}
diff --git a/fit/core-reference/src/test/resources/console.properties b/fit/core-reference/src/test/resources/console.properties
index 27d470b..17c42d3 100644
--- a/fit/core-reference/src/test/resources/console.properties
+++ b/fit/core-reference/src/test/resources/console.properties
@@ -29,6 +29,7 @@ maxUploadFileSizeMB=5
 # Max wait time on apply changes from modals/wizards (given in seconds)
 maxWaitTimeOnApplyChanges=30
 
+x-forward=true
 csrf=false
 
 activitiModelerDirectory=${activiti-modeler.directory}
@@ -53,4 +54,3 @@ page.parameters=org.apache.syncope.client.console.pages.Parameters
 topology.corePoolSize=50
 topology.maxPoolSize=100
 topology.queueCapacity=10
-