[java-plugin-shibd] 02/02: Add a shortcut for deserializing from String.

Codeberg noreply at shibboleth.net
Mon Sep 21 19:49:55 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.

View the commit online:
https://codeberg.org/Shibboleth/java-plugin-shibd/commit/cdf4e07c3cc997ca14ec4178992186c6d37c9c0b

commit cdf4e07c3cc997ca14ec4178992186c6d37c9c0b
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Mon Sep 21 15:49:40 2026 -0400

    Add a shortcut for deserializing from String.
---
 .../src/main/java/net/shibboleth/sp/ddf/DDF.java         | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/ddf/DDF.java b/sp-server-api/src/main/java/net/shibboleth/sp/ddf/DDF.java
index abcf125..842aa7b 100644
--- a/sp-server-api/src/main/java/net/shibboleth/sp/ddf/DDF.java
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/ddf/DDF.java
@@ -14,6 +14,7 @@
 
 package net.shibboleth.sp.ddf;
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -1378,6 +1379,21 @@ public class DDF implements Iterable<DDF> {
         return os;
     }
     
+    /**
+     * Calls {@link #deserialize(InputStream)} using the input as a UTF-8 encoded byte source.
+     * 
+     * @param input serialized DDF in a String
+     * 
+     * @return the parsed object
+     * 
+     * @throws IOException if an error occurs
+     */
+    @Nonnull public static DDF deserialize(@Nonnull @NotEmpty final String input) throws IOException {
+        try (final ByteArrayInputStream source = new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8))) {
+            return deserialize(source);
+        }
+    }
+    
     /**
      * Parses a seralized DDF from an input stream.
      * 

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


More information about the commits mailing list