[java-plugin-shibd-saml] branch main updated: Move logout token prefixing into StateManager.
Codeberg
noreply at shibboleth.net
Mon Jun 1 18:43:14 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/7607d5780093cac83c89d5e23677853d41467e93
The following commit(s) were added to refs/heads/main by this push:
new 7607d57 Move logout token prefixing into StateManager.
7607d57 is described below
commit 7607d5780093cac83c89d5e23677853d41467e93
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Mon Jun 1 14:42:30 2026 -0400
Move logout token prefixing into StateManager.
---
.../idp/flows/sp/logout/consumer/saml2/saml2-beans.xml | 12 ++++++++----
.../sp/saml/flows/saml2/SAML2LogoutConsumerFlowTest.java | 4 ++--
.../saml/flows/saml2/SAML2LogoutConsumerTokenFlowTest.java | 3 ++-
.../sp/saml/saml2/profile/impl/ProcessLogoutRequest.java | 2 +-
.../saml/saml2/profile/impl/ProcessLogoutTokenRequest.java | 4 ++--
.../sp/saml/saml2/profile/impl/ProcessLogoutRequestTest.java | 4 ++--
.../saml2/profile/impl/ProcessLogoutTokenRequestTest.java | 3 ++-
7 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/logout/consumer/saml2/saml2-beans.xml b/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/logout/consumer/saml2/saml2-beans.xml
index 33c5c01..9ff4007 100644
--- a/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/logout/consumer/saml2/saml2-beans.xml
+++ b/sp-saml-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/logout/consumer/saml2/saml2-beans.xml
@@ -17,10 +17,14 @@
<!-- Dummy manager used to generate/consume the "token" operation parameter. -->
<bean id="PassthroughStateManager"
- class="net.shibboleth.sp.state.impl.PassthroughStateManager"
- p:dataSealer-ref="shibboleth.DataSealer"
- p:objectMapper-ref="shibboleth.JSONObjectMapper"
- p:expiration="PT30M" />
+ class="net.shibboleth.sp.state.impl.PassthroughStateManager"
+ p:dataSealer-ref="shibboleth.DataSealer"
+ p:objectMapper-ref="shibboleth.JSONObjectMapper"
+ p:expiration="PT30M">
+ <property name="prefix">
+ <util:constant static-field="net.shibboleth.sp.saml.saml2.profile.impl.ProcessLogoutRequest.TOKEN_PREFIX" />
+ </property>
+ </bean>
<bean id="ProcessLogoutTokenRequest"
class="net.shibboleth.sp.saml.saml2.profile.impl.ProcessLogoutTokenRequest" scope="prototype"
diff --git a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2LogoutConsumerFlowTest.java b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2LogoutConsumerFlowTest.java
index 73dc7e1..0bbebd7 100644
--- a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2LogoutConsumerFlowTest.java
+++ b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2LogoutConsumerFlowTest.java
@@ -214,6 +214,7 @@ public class SAML2LogoutConsumerFlowTest extends AbstractSPFlowTest {
dummyStateManager = new PassthroughStateManager();
dummyStateManager.setId("test");
+ dummyStateManager.setPrefix(ProcessLogoutRequest.TOKEN_PREFIX);
dummyStateManager.setObjectMapper(mapper);
dummyStateManager.setDataSealer(dataSealer);
dummyStateManager.initialize();
@@ -429,8 +430,7 @@ public class SAML2LogoutConsumerFlowTest extends AbstractSPFlowTest {
assert agent != null;
final Application app = agent.getApplication(APPLICATION_ID);
assert app != null;
- stateData = dummyStateManager.recoverFromStateToken(agent, app,
- token.substring(ProcessLogoutRequest.TOKEN_PREFIX.length()), SAMLStateData.class);
+ stateData = dummyStateManager.recoverFromStateToken(agent, app, token, SAMLStateData.class);
}
assert stateData != null;
diff --git a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2LogoutConsumerTokenFlowTest.java b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2LogoutConsumerTokenFlowTest.java
index 25bcd9b..afe5557 100644
--- a/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2LogoutConsumerTokenFlowTest.java
+++ b/sp-saml-conf-impl/src/test/java/net/shibboleth/sp/saml/flows/saml2/SAML2LogoutConsumerTokenFlowTest.java
@@ -133,6 +133,7 @@ public class SAML2LogoutConsumerTokenFlowTest extends AbstractSPFlowTest {
dummyStateManager = new PassthroughStateManager();
dummyStateManager.setId("test");
+ dummyStateManager.setPrefix(ProcessLogoutRequest.TOKEN_PREFIX);
dummyStateManager.setObjectMapper(mapper);
dummyStateManager.setDataSealer(dataSealer);
dummyStateManager.initialize();
@@ -414,7 +415,7 @@ public class SAML2LogoutConsumerTokenFlowTest extends AbstractSPFlowTest {
assert agent != null;
final Application app = agent.getApplication(APPLICATION_ID);
assert app != null;
- return ProcessLogoutRequest.TOKEN_PREFIX + dummyStateManager.preserveToStateToken(agent, app, data);
+ return dummyStateManager.preserveToStateToken(agent, app, data);
}
}
diff --git a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutRequest.java b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutRequest.java
index a49e665..3944022 100644
--- a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutRequest.java
+++ b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutRequest.java
@@ -390,7 +390,7 @@ public class ProcessLogoutRequest extends AbstractApplicationAction {
try {
final String token = stateManager.preserveToStateToken(ensureAgent(), ensureApplication(), state);
- output.addmember(ConsumerConstants.TOKEN_PARAM).string(TOKEN_PREFIX + token);
+ output.addmember(ConsumerConstants.TOKEN_PARAM).string(token);
} catch (final IOException e) {
log.error("{} Exception producing state token", getLogPrefix(), e);
}
diff --git a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutTokenRequest.java b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutTokenRequest.java
index 596d491..a8a91ff 100644
--- a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutTokenRequest.java
+++ b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutTokenRequest.java
@@ -151,8 +151,8 @@ public class ProcessLogoutTokenRequest extends AbstractApplicationAction {
}
try {
- stateData = stateManager.recoverFromStateToken(ensureAgent(), ensureApplication(),
- token.substring(ProcessLogoutRequest.TOKEN_PREFIX.length()), SAMLStateData.class);
+ stateData =
+ stateManager.recoverFromStateToken(ensureAgent(), ensureApplication(), token, SAMLStateData.class);
} catch (final IOException e) {
ActionSupport.buildEvent(profileRequestContext, EventIds.UNABLE_TO_DECODE);
log.error("{} Error decoding '{}' parameter", getLogPrefix(), ConsumerConstants.TOKEN_PARAM, e);
diff --git a/sp-saml-impl/src/test/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutRequestTest.java b/sp-saml-impl/src/test/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutRequestTest.java
index 6bbfd59..f060822 100644
--- a/sp-saml-impl/src/test/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutRequestTest.java
+++ b/sp-saml-impl/src/test/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutRequestTest.java
@@ -108,6 +108,7 @@ public class ProcessLogoutRequestTest extends BaseApplicationActionTest {
stateManager = new PassthroughStateManager();
stateManager.setId("test");
+ stateManager.setPrefix(ProcessLogoutRequest.TOKEN_PREFIX);
stateManager.setDataSealer(sealer);
final ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule());
@@ -397,8 +398,7 @@ public class ProcessLogoutRequestTest extends BaseApplicationActionTest {
private void validateToken(@Nullable final String token) throws IOException {
assert token != null;
Assert.assertTrue(token.startsWith(ProcessLogoutRequest.TOKEN_PREFIX));
- final SAMLStateData data = stateManager.recoverFromStateToken(agent, application,
- token.substring(ProcessLogoutRequest.TOKEN_PREFIX.length()), SAMLStateData.class);
+ final SAMLStateData data = stateManager.recoverFromStateToken(agent, application, token, SAMLStateData.class);
assert data != null;
final LogoutRequest request = (LogoutRequest) prc.ensureInboundMessageContext().getMessage();
diff --git a/sp-saml-impl/src/test/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutTokenRequestTest.java b/sp-saml-impl/src/test/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutTokenRequestTest.java
index f4fd03c..728ad8e 100644
--- a/sp-saml-impl/src/test/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutTokenRequestTest.java
+++ b/sp-saml-impl/src/test/java/net/shibboleth/sp/saml/saml2/profile/impl/ProcessLogoutTokenRequestTest.java
@@ -90,6 +90,7 @@ public class ProcessLogoutTokenRequestTest extends BaseApplicationActionTest {
stateManager = new PassthroughStateManager();
stateManager.setId("test");
+ stateManager.setPrefix(ProcessLogoutRequest.TOKEN_PREFIX);
stateManager.setDataSealer(sealer);
final ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule());
@@ -212,7 +213,7 @@ public class ProcessLogoutTokenRequestTest extends BaseApplicationActionTest {
data.setRequestID(requestID);
data.setResource(relayState);
- return ProcessLogoutRequest.TOKEN_PREFIX + stateManager.preserveToStateToken(agent, application, data);
+ return stateManager.preserveToStateToken(agent, application, data);
}
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list