[java-plugin-shibd-saml] branch main updated: JSHIBD-17 - Support DDF nodes for session data in AbstractTokenConsumerResponseAction
Codeberg
noreply at shibboleth.net
Fri Dec 19 14:23:20 UTC 2025
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/c87965837a0f5624a28a195562eb037173c4bd52
The following commit(s) were added to refs/heads/main by this push:
new c879658 JSHIBD-17 - Support DDF nodes for session data in AbstractTokenConsumerResponseAction
c879658 is described below
commit c87965837a0f5624a28a195562eb037173c4bd52
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Dec 19 14:23:13 2025 +0000
JSHIBD-17 - Support DDF nodes for session data in
AbstractTokenConsumerResponseAction
- Change the session data to a DDF which contains a single nameID
string.
https://shibboleth.atlassian.net/browse/JSHIBD-17
---
.../sp/saml/saml2/profile/impl/PrepareAgentResponse.java | 5 +++--
.../sp/saml/saml2/profile/impl/PrepareAgentResponseTest.java | 12 +++++++-----
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/PrepareAgentResponse.java b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/PrepareAgentResponse.java
index 346c073..68e3a93 100644
--- a/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/PrepareAgentResponse.java
+++ b/sp-saml-impl/src/main/java/net/shibboleth/sp/saml/saml2/profile/impl/PrepareAgentResponse.java
@@ -40,6 +40,7 @@ import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.LoggerFactory;
import net.shibboleth.shared.xml.SerializeSupport;
+import net.shibboleth.sp.ddf.DDF;
import net.shibboleth.sp.profile.AbstractTokenConsumerResponseAction;
import net.shibboleth.sp.saml.saml2.context.SAMLTokenContext;
@@ -112,7 +113,7 @@ public class PrepareAgentResponse extends AbstractTokenConsumerResponseAction {
/** {@inheritDoc} */
@Override
- @Nullable protected String getSessionData(@Nonnull final ProfileRequestContext profileRequestContext) {
+ @Nullable protected DDF getSessionData(@Nonnull final ProfileRequestContext profileRequestContext) {
final Subject subject = samlTokenContext.getSubject();
final NameID nameID = subject != null ? subject.getNameID() : null;
@@ -130,7 +131,7 @@ public class PrepareAgentResponse extends AbstractTokenConsumerResponseAction {
try {
final String xml = SerializeSupport.nodeToString(XMLObjectSupport.marshall(nameID), NO_XML_DECL_PARAMS);
- return Base64Support.encodeURLSafe(xml.getBytes(StandardCharsets.UTF_8));
+ return new DDF("nameID").string(Base64Support.encodeURLSafe(xml.getBytes(StandardCharsets.UTF_8)));
} catch (final MarshallingException | EncodingException e) {
log.error("{} Error marshalling and encoding NameID", getLogPrefix(), e);
}
diff --git a/sp-saml-impl/src/test/java/net/shibboleth/sp/saml/saml2/profile/impl/PrepareAgentResponseTest.java b/sp-saml-impl/src/test/java/net/shibboleth/sp/saml/saml2/profile/impl/PrepareAgentResponseTest.java
index 81814db..9e26644 100644
--- a/sp-saml-impl/src/test/java/net/shibboleth/sp/saml/saml2/profile/impl/PrepareAgentResponseTest.java
+++ b/sp-saml-impl/src/test/java/net/shibboleth/sp/saml/saml2/profile/impl/PrepareAgentResponseTest.java
@@ -15,8 +15,8 @@
package net.shibboleth.sp.saml.saml2.profile.impl;
import java.io.ByteArrayInputStream;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.time.Instant;
@@ -143,10 +143,12 @@ public class PrepareAgentResponseTest extends BaseAgplicationActionTest {
assert out != null;
Assert.assertTrue(out.isstruct());
- final DDF state = out.getmember(ConsumerConstants.SESSION_OPAQUE);
- Assert.assertTrue(state.isstring());
+ final DDF state = out.getmember(ConsumerConstants.SESSION_OPAQUE);
+ Assert.assertTrue(state.isstruct());
+ final DDF nameId = state.getmember("nameID");
+ Assert.assertTrue(nameId.isstring());
- final String encoded = state.string();
+ final String encoded = nameId.string();
assert encoded != null;
final byte[] decoded = Base64Support.decodeURLSafe(encoded);
@@ -156,7 +158,7 @@ public class PrepareAgentResponseTest extends BaseAgplicationActionTest {
final XMLObject xmlobj =
XMLObjectSupport.unmarshallFromInputStream(parserPool, in);
parserPool.destroy();
- if (xmlobj instanceof NameID nameID) {
+ if (xmlobj instanceof final NameID nameID) {
Assert.assertEquals(nameID.getValue(), "jdoe");
Assert.assertEquals(nameID.getSPProvidedID(), "foo");
} else {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list