[java-identity-provider] branch main updated: IDP-2338 - Improve wiring of Spring MVC's CORS-handling feature

Scott Cantor cantor.2 at osu.edu
Tue Mar 25 14:00:27 UTC 2025


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=246fb6fea7b64a4f2e6ccd0ec99b9d1dc72b491c

The following commit(s) were added to refs/heads/main by this push:
     new 246fb6fea IDP-2338 - Improve wiring of Spring MVC's CORS-handling feature
246fb6fea is described below

commit 246fb6fea7b64a4f2e6ccd0ec99b9d1dc72b491c
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Mar 25 10:00:20 2025 -0400

    IDP-2338 - Improve wiring of Spring MVC's CORS-handling feature
    
    https://shibboleth.atlassian.net/browse/IDP-2338
    
    Allow for override of CorsConfigurationSource property.
---
 .../src/main/resources/net/shibboleth/idp/conf/mvc-beans.xml | 10 +++++++++-
 .../test/resources/net/shibboleth/idp/module/conf/global.xml | 12 ++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/mvc-beans.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/mvc-beans.xml
index dafb78809..2daab9499 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/mvc-beans.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/mvc-beans.xml
@@ -25,8 +25,16 @@
         </property>
     </bean>
     
+    <bean id="DefaultCorsSource" class="org.springframework.web.cors.UrlBasedCorsConfigurationSource" lazy-init="true"
+            p:corsConfigurations="#{getObject('shibboleth.CorsConfigurations')}">
+        <constructor-arg>
+            <bean class="org.springframework.web.util.pattern.PathPatternParser" />
+        </constructor-arg>
+    </bean>
+    
     <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping" p:order="0"
-            p:flowRegistry-ref="flowRegistry" p:corsConfigurations="#{getObject('shibboleth.CorsConfigurations')}">
+            p:flowRegistry-ref="flowRegistry"
+            p:corsConfigurationSource="#{getObject('shibboleth.CorsConfigurationSource') ?: getObject('DefaultCorsSource')}">
         <property name="flowUrlHandler">
             <bean class="net.shibboleth.idp.profile.support.PathInfoSupportingFlowUrlHandler"
                 p:supportedFlows="#{getObject('shibboleth.RESTFlows') ?: getObject('shibboleth.DefaultRESTFlows')}" />
diff --git a/idp-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/global.xml b/idp-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/global.xml
index e25be30dd..45648cb74 100644
--- a/idp-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/global.xml
+++ b/idp-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/global.xml
@@ -88,6 +88,18 @@
         <jdbc:script location="classpath:/test/test-jdbc.sql"/>
     </jdbc:initialize-database>
 
+    <!--
+    <util:map id="shibboleth.CorsConfigurations" value-type="org.springframework.web.cors.CorsConfiguration">
+        <entry key="/admin/mdquery">
+            <bean class="org.springframework.web.cors.CorsConfiguration"
+                p:allowedOrigins="https://sp.example.org"
+                p:allowedMethods="GET,POST"
+                p:allowedHeaders="Authorization"
+                p:maxAge="1800" />
+        </entry>
+    </util:map>
+    -->
+    
     <!--
     <bean id="shibboleth.authn.TOTP.SeedSource" parent="shibboleth.authn.TOTP.StaticSeedSource">
         <property name="seeds">

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


More information about the commits mailing list