[java-plugin-shibd-saml] branch main updated: Adjust how unit tests work to facilitate testbed use.

Scott Cantor cantor.2 at osu.edu
Tue Feb 11 20:06:06 UTC 2025


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

scantor pushed a commit to branch main
in repository java-plugin-shibd-saml.

View the commit online:
http://git.shibboleth.net/view/?p=java-plugin-shibd-saml.git;a=commit;h=4064f8e752a39c14198f2da5547204dd77aaecec

The following commit(s) were added to refs/heads/main by this push:
     new 4064f8e  Adjust how unit tests work to facilitate testbed use.
4064f8e is described below

commit 4064f8e752a39c14198f2da5547204dd77aaecec
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Feb 11 15:06:03 2025 -0500

    Adjust how unit tests work to facilitate testbed use.
---
 ...MLEnvironmentApplicationContextInitializer.java |  2 -
 .../net/shibboleth/idp/module/conf/sp/agents.xml   | 83 ++++++++++++++++++++++
 .../idp/module/conf/sp/saml-test-agents.xml        | 50 ++++++++++++-
 .../shibboleth/idp/module/conf/sp/sp.properties    | 34 +++++++++
 .../net/shibboleth/sp/saml-test-beans.xml          |  2 +-
 5 files changed, 166 insertions(+), 5 deletions(-)

diff --git a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/TestSPSAMLEnvironmentApplicationContextInitializer.java b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/TestSPSAMLEnvironmentApplicationContextInitializer.java
index 38161ec..9fd9a2f 100644
--- a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/TestSPSAMLEnvironmentApplicationContextInitializer.java
+++ b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/TestSPSAMLEnvironmentApplicationContextInitializer.java
@@ -44,8 +44,6 @@ public class TestSPSAMLEnvironmentApplicationContextInitializer
         mock.setProperty("idp.home", "classpath:/net/shibboleth/idp/module");
         mock.setProperty("idp.webflows", "classpath*:/flows");
         mock.setProperty("sp.service.agents.resources", "test.sp.saml.AgentResolverResources");
-        mock.setProperty("sp.application.sessionInitiators", "saml2");
-        mock.setProperty("sp.application.tokenConsumers", "saml2/artifact, saml2/post, saml2/post-simplesign");
         mock.setProperty("idp.additionalProperties",
                 "/conf/ldap.properties, /conf/saml-nameid.properties, /conf/services.properties, /conf/admin/admin.properties, /conf/authn/authn.properties, /conf/c14n/subject-c14n.properties, /credentials/secrets.properties, /conf/sp/sp.properties, /conf/sp/saml.properties");
         applicationContext.getEnvironment().getPropertySources().addFirst(mock);
diff --git a/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/agents.xml b/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/agents.xml
new file mode 100644
index 0000000..3556931
--- /dev/null
+++ b/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/agents.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:util="http://www.springframework.org/schema/util"
+       xmlns:p="http://www.springframework.org/schema/p"
+       xmlns:c="http://www.springframework.org/schema/c"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
+                           http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
+                           
+       default-init-method="initialize"
+       default-destroy-method="destroy">
+
+    <!--
+    This is a test agent config file allowing the testbed to be used to exercise agents.
+    It's not used by any unit tests, but overrides the vanilla/empty agents.xml resource
+    present in the SP "root" plugin, which is not SAML/OpenID aware.
+    -->
+
+    <!--
+    This is a master file defining the Agents, Applications, and RelyingParty configurations to use.
+    You can add any number of additional imported files to organize your configuration.
+    
+    By default, the RelyingParty definitions below are used for all Applications unless overridden.
+    
+    This is an "empty" example in that it assumes neither SAML, OpenID, or any other protocols.
+    -->
+
+    <!-- ============ Agents and their Applications ============ -->
+
+    <bean id="sp.example.org" parent="shibboleth.Agent" p:sharedSecrets="foo">
+        <property name="applications">
+            <set>
+                <bean p:id="default" parent="shibboleth.Application"
+                    p:issuer="https://sp.example.org"
+                    p:authenticatingAuthority="urn:mace:incommon:osu.edu" />
+            </set>
+        </property>
+    </bean>
+
+
+    <!-- ============ Profile defaults ============ -->
+    
+    <!-- Used for all applications by default to provide a baseline for profile settings. -->
+
+    <util:list id="shibboleth.DefaultProfileConfigurations">
+        <!-- Your profiles here. -->
+        <ref bean="SAML2.SSO" />
+    </util:list>
+
+
+    <!-- ============ RelyingParty defaults ============ -->
+    
+    <!--
+    These beans are wired into *all* applications across all agents by default. You can create
+    customized alternatives in whatever combination you require to plug into specific application
+    beans.
+    -->
+
+    <!--
+    Unverified RP configuration, defaults to no support for any profiles.
+    
+    "Unverified" typically means the SP has no metadata, or equivalent way of assuring the identity and
+    legitimacy of an IdP system. To run an "open" SP, you can enable profiles here.
+    -->
+    <bean id="shibboleth.UnverifiedRelyingParty" parent="RelyingParty">
+        <property name="profileConfigurations">
+            <list>
+            <!-- Your profiles here. -->
+            </list>
+        </property>
+    </bean>
+
+    <!-- Container for any overrides you want to add, again used for all applications by default. -->
+
+    <util:list id="shibboleth.RelyingPartyOverrides">
+    
+    </util:list>
+
+    <import resource="saml-credentials.xml" />
+    
+</beans>
diff --git a/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/saml-test-agents.xml b/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/saml-test-agents.xml
index 3b60dbe..8cf2702 100644
--- a/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/saml-test-agents.xml
+++ b/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/saml-test-agents.xml
@@ -12,6 +12,12 @@
        default-init-method="initialize"
        default-destroy-method="destroy">
 
+    <!--
+    This file is used in the sp-saml-conf-impl unit tests by overriding the AgentResolver service resources.
+    -->
+
+    <import resource="saml-credentials.xml" />
+
     <bean id="testsp.example.org" parent="shibboleth.Agent" p:sharedSecrets="foo">
         <property name="applications">
             <set>
@@ -37,7 +43,8 @@
 
                 <bean p:id="no-profile" parent="shibboleth.Application"
                     p:issuer="https://testsp.example.org"
-                    p:authenticatingAuthority="https://idp.example.org" />
+                    p:authenticatingAuthority="https://idp.example.org"
+                    p:profileConfigurations-ref="test.NoProfileConfigurations" />
 
                 <bean p:id="no-endpoint" parent="shibboleth.Application"
                     p:issuer="https://testsp.example.org"
@@ -53,6 +60,9 @@
         </property>
     </bean>
 
+    <util:list id="test.NoProfileConfigurations">
+    </util:list>
+
     <util:list id="test.ProfileConfigurations">
         <ref bean="SAML2.SSO" />
         <ref bean="SAML2.ECP" />
@@ -71,6 +81,42 @@
         <ref bean="SAML2.Logout" />
     </util:list>
 
-    <import resource="saml-credentials.xml" />
+    <!-- ============ Profile defaults ============ -->
+    
+    <!-- Used for all applications by default to provide a baseline for profile settings. -->
+
+    <util:list id="shibboleth.DefaultProfileConfigurations">
+        <!-- Your profiles here. -->
+        <ref bean="SAML2.SSO" />
+    </util:list>
+
+
+    <!-- ============ RelyingParty defaults ============ -->
+    
+    <!--
+    These beans are wired into *all* applications across all agents by default. You can create
+    customized alternatives in whatever combination you require to plug into specific application
+    beans.
+    -->
+
+    <!--
+    Unverified RP configuration, defaults to no support for any profiles.
+    
+    "Unverified" typically means the SP has no metadata, or equivalent way of assuring the identity and
+    legitimacy of an IdP system. To run an "open" SP, you can enable profiles here.
+    -->
+    <bean id="shibboleth.UnverifiedRelyingParty" parent="RelyingParty">
+        <property name="profileConfigurations">
+            <list>
+            <!-- Your profiles here. -->
+            </list>
+        </property>
+    </bean>
+
+    <!-- Container for any overrides you want to add, again used for all applications by default. -->
+
+    <util:list id="shibboleth.RelyingPartyOverrides">
+    
+    </util:list>
 
 </beans>
diff --git a/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/sp.properties b/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/sp.properties
new file mode 100644
index 0000000..e006d59
--- /dev/null
+++ b/sp-saml-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/sp.properties
@@ -0,0 +1,34 @@
+# Controls configuration of service to resolve SP agents and applications
+# Uncomment and define to override service resources
+#sp.service.agents.resources = shibboleth.AgentResolverResources
+#sp.service.agents.failFast = false
+sp.service.agents.checkInterval = PT5M
+
+# Set to empty value to skip shared secret authentication
+#sp.agent.authn.method = basic
+# Set false to globally disable cookie-based authentication by agents
+#sp.agent.authn.cached = true
+#sp.agent.authn.cacheDuration = PT1H
+
+# Set to StorageService to use for remoted storage data if in use.
+#sp.storageService = shibboleth.StorageService
+# Set to DataSealer to use for remoted data encryption.
+#sp.dataSealer = shibboleth.DataSealer
+
+# Default precedence/set of Session Initiator and Token Consumer flows to attempt
+sp.application.sessionInitiators = saml2
+sp.application.tokenConsumers = saml2/artifact, saml2/post, saml2/post-simplesign
+
+
+# General SP cookie properties (maxAge only applies to persistent cookies)
+#sp.cookie.secure = true
+#sp.cookie.httpOnly = true
+#sp.cookie.domain =
+#sp.cookie.path =
+#sp.cookie.maxAge = 31536000
+
+# Default state token management (SAML RelayState, etc.)
+# Set to shibboleth.CookieStateTokenManager to switch to cookie-based mechanism
+#sp.stateToken.Manager = shibboleth.StorageStateTokenManager
+# Controls storage back-end for storage-based state tokens
+#sp.stateToken.StorageService = shibboleth.StorageService
diff --git a/sp-saml-conf-impl/src/test/resources/net/shibboleth/sp/saml-test-beans.xml b/sp-saml-conf-impl/src/test/resources/net/shibboleth/sp/saml-test-beans.xml
index 56a8c7f..959f119 100644
--- a/sp-saml-conf-impl/src/test/resources/net/shibboleth/sp/saml-test-beans.xml
+++ b/sp-saml-conf-impl/src/test/resources/net/shibboleth/sp/saml-test-beans.xml
@@ -14,9 +14,9 @@
        default-init-method="initialize"
        default-destroy-method="destroy">
 
+    <!-- Used in sp-saml-conf-impl unit tests for overriding resources and installing dummy creds for signing test data. -->
       
     <util:list id="test.sp.saml.AgentResolverResources">
-        <value>%{idp.home}/conf/sp/agents.xml</value>
         <value>%{idp.home}/conf/sp/saml-test-agents.xml</value>
     </util:list>
 

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


More information about the commits mailing list