[java-plugin-shibd-saml] branch main updated: Add additional ECP test.
Codeberg
noreply at shibboleth.net
Tue Aug 11 14:56:46 UTC 2026
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch main
in repository java-plugin-shibd-saml.
View the commit online:
https://codeberg.org/Shibboleth/java-plugin-shibd-saml/commit/53d9f115061c3a26355c9a4d1e03343477e7c6a3
The following commit(s) were added to refs/heads/main by this push:
new 53d9f11 Add additional ECP test.
53d9f11 is described below
commit 53d9f115061c3a26355c9a4d1e03343477e7c6a3
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Tue Aug 11 10:56:35 2026 -0400
Add additional ECP test.
---
.../flows/saml2/SAML2TokenConsumerFlowTest.java | 42 +++++++++++++++-------
1 file changed, 29 insertions(+), 13 deletions(-)
diff --git a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2TokenConsumerFlowTest.java b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2TokenConsumerFlowTest.java
index d4bc520..9c86aa4 100644
--- a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2TokenConsumerFlowTest.java
+++ b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2TokenConsumerFlowTest.java
@@ -27,7 +27,6 @@ import javax.annotation.Nullable;
import org.opensaml.core.xml.XMLObjectBuilder;
import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
import org.opensaml.core.xml.io.MarshallingException;
-import org.opensaml.core.xml.io.UnmarshallingException;
import org.opensaml.core.xml.util.XMLObjectSupport;
import org.opensaml.profile.action.EventIds;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -82,7 +81,6 @@ import net.shibboleth.idp.profile.IdPEventIds;
import net.shibboleth.idp.spring.IdPPropertiesApplicationContextInitializer;
import net.shibboleth.idp.test.PreferFileSystemApplicationContextInitializer;
import net.shibboleth.shared.codec.Base64Support;
-import net.shibboleth.shared.codec.DecodingException;
import net.shibboleth.shared.codec.EncodingException;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.Pair;
@@ -97,7 +95,6 @@ import net.shibboleth.shared.resolver.ResolverException;
import net.shibboleth.shared.security.IdentifierGenerationStrategy;
import net.shibboleth.shared.service.ReloadableService;
import net.shibboleth.shared.service.ServiceableComponent;
-import net.shibboleth.shared.xml.XMLParserException;
import net.shibboleth.sp.Agent;
import net.shibboleth.sp.AgentCredentialCriterion;
import net.shibboleth.sp.AgentResolver;
@@ -116,7 +113,7 @@ import net.shibboleth.sp.state.StateData;
import net.shibboleth.sp.state.impl.CookieStateManager;
/**
- * Unit test for the SP session-initiator flow.
+ * Unit test for the saml2 session-initiator flows, including ECP.
*/
@ContextConfiguration(
locations = {
@@ -711,7 +708,6 @@ public class SAML2TokenConsumerFlowTest extends AbstractSPFlowTest {
assertFlowExecutionOutcome(result.getOutcome());
final DDF output = assertOutputMessageSuccess(result);
assert output != null;
- System.out.println("testSuccess output: " + output.toString());
validateOutputMessage(result, CollectionSupport.singleton("mail"),
RESOURCE_URL, response.getAssertions().get(0).getAuthnStatements().get(0).getSessionIndex());
}
@@ -739,7 +735,6 @@ public class SAML2TokenConsumerFlowTest extends AbstractSPFlowTest {
assertFlowExecutionOutcome(result.getOutcome());
final DDF output = assertOutputMessageSuccess(result);
assert output != null;
- System.out.println("testSuccess output: " + output.toString());
validateOutputMessage(result, CollectionSupport.singleton("mail"),
RESOURCE_URL, response.getAssertions().get(0).getAuthnStatements().get(0).getSessionIndex());
}
@@ -769,7 +764,6 @@ public class SAML2TokenConsumerFlowTest extends AbstractSPFlowTest {
assertFlowExecutionOutcome(result.getOutcome());
final DDF output = assertOutputMessageSuccess(result);
assert output != null;
- System.out.println("testSuccessAttributes output: " + output.toString());
validateOutputMessage(result, CollectionSupport.setOf("mail", "displayName", "eduPersonScopedAffiliation"),
RESOURCE_URL, response.getAssertions().get(0).getAuthnStatements().get(0).getSessionIndex());
}
@@ -792,7 +786,31 @@ public class SAML2TokenConsumerFlowTest extends AbstractSPFlowTest {
assertFlowExecutionOutcome(result.getOutcome());
final DDF output = assertOutputMessageSuccess(result);
assert output != null;
- System.out.println("testSuccess output: " + output.toString());
+ validateOutputMessage(result, CollectionSupport.singleton("mail"),
+ RESOURCE_URL, response.getAssertions().get(0).getAuthnStatements().get(0).getSessionIndex());
+ }
+
+ /**
+ * Test successful ECP flow.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testSuccessECPWithState() throws Exception {
+ final StateData data = buildStateData("foo");
+ final String stateToken = getStateToken(data);
+
+ final Response response = buildSAMLResponse(ISSUER, StatusCode.SUCCESS, "foo");
+ sign(response);
+
+ final DDF input = buildRemotedECPResponse(buildECPResponse(response, stateToken), response2.getCookies()[0]);
+ setApplicationRequest(APPLICATION_ID, input);
+
+ final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
+ assertFlowExecutionResult(result, FLOW_ID);
+ assertFlowExecutionOutcome(result.getOutcome());
+ final DDF output = assertOutputMessageSuccess(result);
+ assert output != null;
validateOutputMessage(result, CollectionSupport.singleton("mail"),
RESOURCE_URL, response.getAssertions().get(0).getAuthnStatements().get(0).getSessionIndex());
}
@@ -807,13 +825,11 @@ public class SAML2TokenConsumerFlowTest extends AbstractSPFlowTest {
*
* @return the output object
*
- * @throws UnmarshallingException
- * @throws XMLParserException
- * @throws IOException
- * @throws DecodingException
+ * @throws Exception
*/
@Nonnull private DDF validateOutputMessage(@Nonnull final FlowExecutionResult result,
- @Nullable final Set<String> attributeIds, @Nullable final String resource, @Nullable final String sessionIndex) throws DecodingException, IOException, XMLParserException, UnmarshallingException {
+ @Nullable final Set<String> attributeIds, @Nullable final String resource, @Nullable final String sessionIndex)
+ throws Exception {
final ProfileRequestContext prc = retrieveProfileRequestContext(result);
assert prc != null;
final AgentRequestContext arc = prc.ensureSubcontext(AgentRequestContext.class);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list