[java-plugin-shibd] branch main updated: Flesh out validation.

Scott Cantor cantor.2 at osu.edu
Wed Aug 20 23:54:12 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.

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

The following commit(s) were added to refs/heads/main by this push:
     new f7d0fae  Flesh out validation.
f7d0fae is described below

commit f7d0fae7acfa024003c664e94d6731622341a420
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Aug 20 19:54:07 2025 -0400

    Flesh out validation.
---
 .../shibboleth/sp/service/AgentResolverTest.java   | 40 ++++++++++++++++++++--
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/sp-conf-impl/src/test/java/net/shibboleth/sp/service/AgentResolverTest.java b/sp-conf-impl/src/test/java/net/shibboleth/sp/service/AgentResolverTest.java
index 44c3568..3b349aa 100644
--- a/sp-conf-impl/src/test/java/net/shibboleth/sp/service/AgentResolverTest.java
+++ b/sp-conf-impl/src/test/java/net/shibboleth/sp/service/AgentResolverTest.java
@@ -23,6 +23,9 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import net.shibboleth.idp.test.PreferFileSystemContextLoader;
+import net.shibboleth.profile.context.RelyingPartyContext;
+import net.shibboleth.profile.relyingparty.RelyingPartyConfiguration;
+import net.shibboleth.profile.relyingparty.VerifiedProfileCriterion;
 import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.component.ComponentInitializationException;
 import net.shibboleth.shared.net.IPRange;
@@ -37,6 +40,8 @@ import net.shibboleth.sp.AgentResolver;
 import net.shibboleth.sp.Application;
 import net.shibboleth.sp.impl.BasicApplication;
 
+import org.opensaml.profile.context.ProfileRequestContext;
+import org.opensaml.profile.criterion.ProfileRequestContextCriterion;
 import org.springframework.context.ApplicationContextInitializer;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.core.Ordered;
@@ -92,8 +97,6 @@ public class AgentResolverTest extends AbstractTestNGSpringContextTests {
         validateDefaults(agent);
         Assert.assertEquals(agent.getSharedSecrets(), CollectionSupport.singletonList("foo"));
         
-        
-        
         Assert.assertEquals(agent.getId(), "testsp.example.org");
     }
     
@@ -112,7 +115,34 @@ public class AgentResolverTest extends AbstractTestNGSpringContextTests {
         }
     }
     
-    private void validateDefaults(@Nonnull final Agent agent) {
+    /**
+     * Resolve a {@link RelyingPartyConfiguration}.
+     * 
+     * @param app container to query
+     * @param relyingPartyId ID of relying party
+     * 
+     * @return the result
+     * 
+     * @throws ResolverException on error
+     */
+    @Nullable private RelyingPartyConfiguration resolveRelyingParty(@Nonnull final Application app,
+            @Nonnull final String relyingPartyId) throws ResolverException {
+        final ProfileRequestContext prc = new ProfileRequestContext();
+        prc.ensureSubcontext(RelyingPartyContext.class).setRelyingPartyId(relyingPartyId);
+        final CriteriaSet criteria = new CriteriaSet();
+        criteria.add(new VerifiedProfileCriterion(true));
+        criteria.add(new ProfileRequestContextCriterion(prc));
+        return app.resolveSingle(criteria);
+    }
+    
+    /**
+     * Check that the default settings are in place for the agent.
+     * 
+     * @param agent agent to check
+     * 
+     * @throws ResolverException on error 
+     */
+    private void validateDefaults(@Nonnull final Agent agent) throws ResolverException {
         Assert.assertEquals(agent.getApplications().size(), 1);
         Assert.assertEquals(agent.getAllowedAddressRanges(),
                 CollectionSupport.setOf(IPRange.parseCIDRBlock("127.0.0.1/32"), IPRange.parseCIDRBlock("::1/128")));
@@ -126,7 +156,11 @@ public class AgentResolverTest extends AbstractTestNGSpringContextTests {
         
         if (app instanceof BasicApplication basic) {
             Assert.assertEquals(basic.getIssuer(null), "https://sp.example.org");
+            Assert.assertTrue(basic.getProfileConfigurations(null).isEmpty());
         }
+        
+        final RelyingPartyConfiguration rpc = resolveRelyingParty(app, "https://idp.example.org");
+        Assert.assertSame(app, rpc);
     }
     
     /**

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


More information about the commits mailing list