[java-identity-provider] branch maint-4 updated: IDP-2018 - Add "contains" helper method to IdPAttribute for value checks

Scott Cantor cantor.2 at osu.edu
Mon Oct 10 17:37:17 UTC 2022


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

scantor pushed a commit to branch maint-4
in repository java-identity-provider.

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

The following commit(s) were added to refs/heads/maint-4 by this push:
     new b675766e8 IDP-2018 - Add "contains" helper method to IdPAttribute for value checks
b675766e8 is described below

commit b675766e8d9681f37d802d67014cbc361b1042d7
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Oct 10 13:37:14 2022 -0400

    IDP-2018 - Add "contains" helper method to IdPAttribute for value checks
    
    https://shibboleth.atlassian.net/browse/IDP-2018
---
 .../net/shibboleth/idp/attribute/IdPAttribute.java     | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttribute.java b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttribute.java
index db90a4b99..4aa73613b 100644
--- a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttribute.java
+++ b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttribute.java
@@ -249,6 +249,24 @@ public class IdPAttribute implements Comparable<IdPAttribute>, Cloneable {
             values = Collections.emptyList();
         }
     }
+    
+    /**
+     * Check for a string value amongst this object's value collection.
+     * 
+     * @param value value to check for
+     * 
+     * @return true iff a {@link StringAttributeValue} exists with the input value
+     * 
+     * @since 4.3.0
+     */
+    public boolean contains(@Nonnull @NotEmpty final String value) {
+        for (final IdPAttributeValue v : values) {
+            if (v instanceof StringAttributeValue && ((StringAttributeValue) v).getValue().equals(value)) {
+                return true;
+            }
+        }
+        return false;
+    }
 
     /** {@inheritDoc} */
     @Override

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


More information about the commits mailing list