[java-identity-provider] branch main updated: IDP-2015 - Review web.xml for improvements via code or annotations

Scott Cantor cantor.2 at osu.edu
Mon Oct 3 14:02:15 UTC 2022


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=cf7979411f68aa3c7c66d183758f3a5a409d6a22

The following commit(s) were added to refs/heads/main by this push:
     new cf7979411 IDP-2015 - Review web.xml for improvements via code or annotations
cf7979411 is described below

commit cf7979411f68aa3c7c66d183758f3a5a409d6a22
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Oct 3 10:02:12 2022 -0400

    IDP-2015 - Review web.xml for improvements via code or annotations
    
    https://shibboleth.atlassian.net/browse/IDP-2015
    
    Remove CharacterEncodingFilter and move to Spring wiring.
---
 .../resources/net/shibboleth/idp/conf/filters.xml     |  8 +++++++-
 idp-conf/src/main/resources/conf/idp.properties       |  3 +++
 idp-war/src/main/webapp/WEB-INF/web.xml               | 19 +------------------
 3 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/filters.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/filters.xml
index 223e66bbc..c3e0b3c47 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/filters.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/filters.xml
@@ -53,6 +53,12 @@
         p:defaultValue="%{idp.cookie.sameSite:None}"
         p:sameSiteCookies="#{getObject('shibboleth.SameSiteCookieMap')}" />
 
+    <!-- Runs NEUTRAL, can be disabled if desired. -->
+    <bean class="net.shibboleth.shared.spring.servlet.impl.CharacterEncodingFilter"
+        p:activationCondition="%{idp.encoding.forceUTF8:true}"
+        p:encoding="UTF-8"
+        p:forceEncoding="true" />
+
     <!--
     This was, Scott thinks, needed for client storage to work, but if it runs, it has to be after the
     SameSite filter; i.e. it needs to execute on the response before that one does, so runs NEUTRAL.
@@ -65,7 +71,7 @@
         p:activationCondition-ref="UserFacingPrefixPredicate"
         p:headers="#{getObject('shibboleth.ResponseHeaderMap') ?: getObject('shibboleth.DefaultResponseHeaderMap')}"
         p:callbacks="#{getObject('shibboleth.ResponseHeaderCallbacks')}" />
-
+    
     <!-- Evaluates auto-wired paths against a requested URL. -->
     <bean id="UserFacingPrefixPredicate" class="net.shibboleth.shared.spring.servlet.RequestURLPrefixPredicate" />
 
diff --git a/idp-conf/src/main/resources/conf/idp.properties b/idp-conf/src/main/resources/conf/idp.properties
index 413bed209..f630f8e73 100644
--- a/idp-conf/src/main/resources/conf/idp.properties
+++ b/idp-conf/src/main/resources/conf/idp.properties
@@ -43,6 +43,9 @@ idp.csrf.enabled = true
 # Content-Security-Policy value, set to match X-Frame-Options default
 #idp.csp = frame-ancestors 'none';
 
+# Set to false to disable filter that forcibly applies UTF-8 encoding
+#idp.encoding.forceUTF8 = true
+
 # Set the location of user-supplied web flow definitions
 #idp.webflows = %{idp.home}/flows
 
diff --git a/idp-war/src/main/webapp/WEB-INF/web.xml b/idp-war/src/main/webapp/WEB-INF/web.xml
index c2de9279f..b4c58c01e 100644
--- a/idp-war/src/main/webapp/WEB-INF/web.xml
+++ b/idp-war/src/main/webapp/WEB-INF/web.xml
@@ -27,30 +27,13 @@
     </listener>
     
     <!-- Filters and filter mappings -->
-    
-    <!-- Try and force I18N, probably won't help much. -->
-    <filter>
-        <filter-name>CharacterEncodingFilter</filter-name>
-        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
-        <init-param>
-            <param-name>encoding</param-name>
-            <param-value>UTF-8</param-value>
-        </init-param>
-        <init-param>
-            <param-name>forceEncoding</param-name>
-            <param-value>true</param-value>
-        </init-param>
-    </filter>
+
     <!-- Manages logging MDC. -->
     <filter>
         <filter-name>SLF4JMDCServletFilter</filter-name>
         <filter-class>net.shibboleth.idp.log.SLF4JMDCServletFilter</filter-class>
     </filter>
     
-    <filter-mapping>
-        <filter-name>CharacterEncodingFilter</filter-name>
-        <url-pattern>/*</url-pattern>
-    </filter-mapping>
     <filter-mapping>
         <filter-name>SLF4JMDCServletFilter</filter-name>
         <url-pattern>/*</url-pattern>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list