[java-plugin-shibd] branch main updated: Flesh out unit tests a bit.
Scott Cantor
cantor.2 at osu.edu
Mon Jul 29 20:20:55 UTC 2024
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=42046cb6293bab85c7c56f364525e100ca264592
The following commit(s) were added to refs/heads/main by this push:
new 42046cb Flesh out unit tests a bit.
42046cb is described below
commit 42046cb6293bab85c7c56f364525e100ca264592
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Jul 29 16:20:51 2024 -0400
Flesh out unit tests a bit.
---
.../shibboleth/sp/flows/AbstractSPFlowTest.java | 7 ++--
.../flows/saml2/SAML2SessionInitiatorFlowTest.java | 39 ++++++++++++++++++++--
.../shibboleth/idp/module/conf/sp/test-agents.xml | 9 +++++
3 files changed, 50 insertions(+), 5 deletions(-)
diff --git a/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/AbstractSPFlowTest.java b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/AbstractSPFlowTest.java
index 038b889..d95d702 100644
--- a/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/AbstractSPFlowTest.java
+++ b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/AbstractSPFlowTest.java
@@ -61,6 +61,9 @@ public abstract class AbstractSPFlowTest extends AbstractFlowTest {
/** Test agent ID. */
@Nonnull public static final String AGENT_ID = "testsp.example.org";
+
+ /** Test application ID. */
+ @Nonnull public static final String APPLICATION_ID = "default";
protected String flowId;
@@ -138,9 +141,9 @@ public abstract class AbstractSPFlowTest extends AbstractFlowTest {
request.setContent(body.getBytes());
}
- protected void setApplicationRequest(@Nullable final String applicationId) throws IOException {
+ protected void setApplicationRequest(@Nonnull final String applicationId) throws IOException {
final DDF input = new DDF(null).structure();
- input.addmember(ResolveApplication.APPLICATION_ID).string(applicationId != null ? applicationId : "default");
+ input.addmember(ResolveApplication.APPLICATION_ID).string(applicationId);
setRequest("POST", input);
}
diff --git a/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/saml2/SAML2SessionInitiatorFlowTest.java b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/saml2/SAML2SessionInitiatorFlowTest.java
index 69e0e47..2779f3f 100644
--- a/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/saml2/SAML2SessionInitiatorFlowTest.java
+++ b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/saml2/SAML2SessionInitiatorFlowTest.java
@@ -22,11 +22,12 @@ import org.springframework.webflow.executor.FlowExecutionResult;
import org.testng.Assert;
import org.testng.annotations.Test;
+import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.sp.ddf.DDF;
import net.shibboleth.sp.flows.AbstractSPFlowTest;
/**
- * Unit test for the SP session-initiator flow (basics only).
+ * Unit test for the SP session-initiator flow.
*/
public class SAML2SessionInitiatorFlowTest extends AbstractSPFlowTest {
@@ -36,7 +37,39 @@ public class SAML2SessionInitiatorFlowTest extends AbstractSPFlowTest {
protected SAML2SessionInitiatorFlowTest() {
super(FLOW_ID);
}
-
+
+ /**
+ * Test flow with unverified (no metadata) IdP specified.
+ *
+ * @throws IOException
+ */
+ @Test
+ public void testUnverified() throws IOException {
+ setDefaultAuth();
+ setApplicationRequest("no-metadata");
+
+ final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
+ assertFlowExecutionResult(result, FLOW_ID);
+ assertFlowExecutionOutcome(result.getOutcome());
+ assertOutputMessageEvent(result, AuthnEventIds.NO_POTENTIAL_FLOW);
+ }
+
+ /**
+ * Test flow with profile disallowed.
+ *
+ * @throws IOException
+ */
+ @Test
+ public void testProfileDisabled() throws IOException {
+ setDefaultAuth();
+ setApplicationRequest("no-profile");
+
+ final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
+ assertFlowExecutionResult(result, FLOW_ID);
+ assertFlowExecutionOutcome(result.getOutcome());
+ assertOutputMessageEvent(result, AuthnEventIds.NO_POTENTIAL_FLOW);
+ }
+
/**
* Test basic use of flow.
*
@@ -45,7 +78,7 @@ public class SAML2SessionInitiatorFlowTest extends AbstractSPFlowTest {
@Test
public void testSimple() throws IOException {
setDefaultAuth();
- setApplicationRequest(null);
+ setApplicationRequest(APPLICATION_ID);
final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
assertFlowExecutionResult(result, FLOW_ID);
diff --git a/sp-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/test-agents.xml b/sp-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/test-agents.xml
index f556b2a..15a3693 100644
--- a/sp-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/test-agents.xml
+++ b/sp-conf-impl/src/test/resources/net/shibboleth/idp/module/conf/sp/test-agents.xml
@@ -18,6 +18,15 @@
<bean p:id="default" parent="shibboleth.Application"
p:issuer="https://testsp.example.org"
p:authenticatingAuthority="https://idp.example.org" />
+
+ <bean p:id="no-metadata" parent="shibboleth.Application"
+ p:issuer="https://testsp.example.org"
+ p:authenticatingAuthority="https://unknown.example.org" />
+
+ <bean p:id="no-profile" parent="shibboleth.Application"
+ p:issuer="https://testsp.example.org"
+ p:authenticatingAuthority="https://idp.example.org"
+ p:defaultConfiguration-ref="shibboleth.UnverifiedRelyingParty" />
<bean p:id="no-initiators" parent="shibboleth.Application"
p:issuer="https://testsp.example.org"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list