[java-opensaml] branch maint-5.1 updated: OSJ-429 - Spurious warning on unsigned SAML redirect messages

Scott Cantor cantor.2 at osu.edu
Wed Aug 6 14:45:19 UTC 2025


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch maint-5.1
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=beb0611ddadcc63fec0d2e74b7a6a83b481d810c

The following commit(s) were added to refs/heads/maint-5.1 by this push:
     new beb0611dd OSJ-429 - Spurious warning on unsigned SAML redirect messages
beb0611dd is described below

commit beb0611ddadcc63fec0d2e74b7a6a83b481d810c
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Mar 27 09:49:19 2025 -0400

    OSJ-429 - Spurious warning on unsigned SAML redirect messages
    
    https://shibboleth.atlassian.net/browse/OSJ-429
    
    Also replaced indirect lookups of UTF-8 encoding.
---
 .../binding/decoding/impl/HTTPPostSimpleSignDecoder.java | 16 ++++------------
 .../decoding/impl/HTTPRedirectDeflateDecoder.java        | 15 +++++----------
 2 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPPostSimpleSignDecoder.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPPostSimpleSignDecoder.java
index fea706cc4..dac75508e 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPPostSimpleSignDecoder.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPPostSimpleSignDecoder.java
@@ -14,7 +14,7 @@
 
 package org.opensaml.saml.saml2.binding.decoding.impl;
 
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -91,20 +91,17 @@ public class HTTPPostSimpleSignDecoder extends HTTPPostDecoder {
             if (request.getParameter("SAMLRequest") != null) {
                 final String paramValue = request.getParameter("SAMLRequest");
                 assert paramValue != null;
-                samlMsg = new String(Base64Support.decode(paramValue), "UTF-8");
+                samlMsg = new String(Base64Support.decode(paramValue), StandardCharsets.UTF_8);
                 builder.append("SAMLRequest=" + samlMsg);
             } else if (request.getParameter("SAMLResponse") != null) {
                 final String paramValue = request.getParameter("SAMLResponse");
                 assert paramValue != null;
-                samlMsg = new String(Base64Support.decode(paramValue), "UTF-8");
+                samlMsg = new String(Base64Support.decode(paramValue), StandardCharsets.UTF_8);
                 builder.append("SAMLResponse=" + samlMsg);
             } else {
                 log.warn("Could not extract either a SAMLRequest or a SAMLResponse from the form control data");
                 return null;
             }
-        } catch (final UnsupportedEncodingException e) {
-            log.error("UTF-8 encoding is not supported, this VM is not Java compliant");
-            throw new MessageDecodingException("Unable to process message, UTF-8 encoding is not supported");
         } catch (final DecodingException e) {
             log.error("Unable to Base64 decode either a SAMLRequest or a SAMLResponse from the form control data");
             throw new MessageDecodingException("Unable to Base64 decode either a SAMLRequest or a SAMLResponse "
@@ -130,12 +127,7 @@ public class HTTPPostSimpleSignDecoder extends HTTPPostDecoder {
         }
         log.debug("Constructed signed content string for HTTP-Post-SimpleSign {}", constructed);
 
-        try {
-            return constructed.getBytes("UTF-8");
-        } catch (final UnsupportedEncodingException e) {
-            log.error("UTF-8 encoding is not supported, this VM is not Java compliant");
-            throw new MessageDecodingException("Unable to process message, UTF-8 encoding is not supported");
-        }
+        return constructed.getBytes(StandardCharsets.UTF_8);
     }
     
 }
\ No newline at end of file
diff --git a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoder.java b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoder.java
index bd6dd8b3e..c5832294b 100644
--- a/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoder.java
+++ b/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/binding/decoding/impl/HTTPRedirectDeflateDecoder.java
@@ -17,7 +17,7 @@ package org.opensaml.saml.saml2.binding.decoding.impl;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -174,18 +174,13 @@ public class HTTPRedirectDeflateDecoder extends BaseSAMLHttpServletRequestDecode
 
         final String constructed = buildSignedContentString(queryString, samlMessageParamName, samlMessage);
         if (Strings.isNullOrEmpty(constructed)) {
-            log.warn("Could not extract signed content string from query string");
+            log.debug("Could not extract signed content string from query string");
             return null;
         }
         assert constructed != null;
         log.debug("Constructed signed content string for HTTP-Redirect DEFLATE {}", constructed);
 
-        try {
-            return constructed.getBytes("UTF-8");
-        } catch (final UnsupportedEncodingException e) {
-            log.error("UTF-8 encoding is not supported, this VM is not Java compliant");
-            throw new MessageDecodingException("Unable to process message, UTF-8 encoding is not supported");
-        }
+        return constructed.getBytes(StandardCharsets.UTF_8);
     }
 
     /**
@@ -206,7 +201,7 @@ public class HTTPRedirectDeflateDecoder extends BaseSAMLHttpServletRequestDecode
         final StringBuilder builder = new StringBuilder();
 
         if (!appendSAMLMessageParameter(builder, queryString, samlMessageParamName, samlMessage)) {
-            log.warn("Could not extract SAML message '{}' from the query string, cannot build simple signature content",
+            log.info("Could not extract SAML message '{}' from the query string, cannot build simple signature content",
                     samlMessageParamName);
             return null;
         }
@@ -216,7 +211,7 @@ public class HTTPRedirectDeflateDecoder extends BaseSAMLHttpServletRequestDecode
 
         // This is mandatory
         if (!appendParameter(builder, queryString, "SigAlg")) {
-            log.warn("Signature algorithm could not be extracted from request, cannot build simple signature content");
+            log.debug("Signature algorithm could not be extracted from request, cannot build simple signature content");
             return null;
         }
 

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


More information about the commits mailing list