[java-plugin-shibd] branch main updated: Commit new condition class used by SAML plugin.

Codeberg noreply at shibboleth.net
Wed May 27 13:13:08 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/25c63cbac77ba3d5d6deeafb79051b3aa1953ad9

The following commit(s) were added to refs/heads/main by this push:
     new 25c63cb  Commit new condition class used by SAML plugin.
25c63cb is described below

commit 25c63cbac77ba3d5d6deeafb79051b3aa1953ad9
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Wed May 27 09:08:51 2026 -0400

    Commit new condition class used by SAML plugin.
---
 .../context/logic/InputStartsWithPredicate.java    | 69 ++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/profile/context/logic/InputStartsWithPredicate.java b/sp-server-api/src/main/java/net/shibboleth/sp/profile/context/logic/InputStartsWithPredicate.java
new file mode 100644
index 0000000..e1b13f2
--- /dev/null
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/profile/context/logic/InputStartsWithPredicate.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.sp.profile.context.logic;
+
+import java.util.function.Predicate;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.opensaml.profile.context.ProfileRequestContext;
+
+import net.shibboleth.shared.annotation.ParameterName;
+import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.StringSupport;
+import net.shibboleth.sp.context.AgentRequestContext;
+import net.shibboleth.sp.ddf.DDF;
+
+/**
+ * Custom condition class that checks an input parameter of a given name and checks
+ * that it starts with a supplied substring.
+ */
+public class InputStartsWithPredicate implements Predicate<ProfileRequestContext> {
+
+    /** Name of parameter to check for. */
+    @Nonnull final String parameterName;
+    
+    /** Prefix of value to check for. */
+    @Nonnull final String valuePrefix;
+    
+    /**
+     * Constructor.
+     *
+     * @param name parameter name to check for
+     * @param prefix value prefix to check for
+     */
+    InputStartsWithPredicate(@Nonnull @ParameterName(name="name") final String name,
+            @Nonnull @ParameterName(name="prefix") final String prefix) {
+        parameterName = Constraint.isNotNull(StringSupport.trimOrNull(name), "Parameter name cannot be null or empty");
+        valuePrefix = Constraint.isNotEmpty(prefix, "Prefix cannot be null or empty");
+    }
+    
+    /** {@inheritDoc} */
+    public boolean test(@Nullable final ProfileRequestContext input) {
+        if (input != null) {
+            final AgentRequestContext agentRequestContext = input.getSubcontext(AgentRequestContext.class);
+            if (agentRequestContext != null) {
+                final DDF msg = agentRequestContext.getInput();
+                if (msg != null) {
+                    final String value = msg.getmember(parameterName).string();
+                    return value != null ? value.startsWith(valuePrefix) : false;
+                }
+            }
+        }
+        return false;
+    }
+
+}
\ 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