[java-shib-attribute] branch main updated: Remove gratuitous test use of commons-codec.

Codeberg noreply at shibboleth.net
Thu Oct 22 13:58:16 UTC 2026


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

codeberg pushed a commit to branch main
in repository java-shib-attribute.

View the commit online:
https://codeberg.org/Shibboleth/java-shib-attribute/commit/90c6ec3ed980e024e3d832160e61f35efc269ddb

The following commit(s) were added to refs/heads/main by this push:
     new 90c6ec3ed Remove gratuitous test use of commons-codec.
90c6ec3ed is described below

commit 90c6ec3ed980e024e3d832160e61f35efc269ddb
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Thu Oct 22 09:57:40 2026 -0400

    Remove gratuitous test use of commons-codec.
---
 .../idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java     | 8 +++++---
 .../net/shibboleth/idp/attribute/resolver/impl/ad/example1.script | 7 +++----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java
index f2bdee3a7..558d3d215 100644
--- a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java
+++ b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java
@@ -22,6 +22,7 @@ import static org.testng.Assert.fail;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
@@ -33,7 +34,6 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.script.ScriptException;
 
-import org.apache.commons.codec.digest.DigestUtils;
 import org.opensaml.core.testing.XMLObjectBaseTestCase;
 import org.opensaml.saml.ext.saml2mdattr.EntityAttributes;
 import org.opensaml.saml.saml2.core.Attribute;
@@ -56,6 +56,8 @@ import net.shibboleth.idp.attribute.resolver.impl.AttributeResolverImpl;
 import net.shibboleth.idp.attribute.resolver.impl.AttributeResolverImplTest;
 import net.shibboleth.idp.attribute.resolver.testing.ResolverTestSupport;
 import net.shibboleth.idp.attribute.resolver.testing.TestSources;
+import net.shibboleth.shared.codec.StringDigester;
+import net.shibboleth.shared.codec.StringDigester.OutputFormat;
 import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.collection.LazySet;
 import net.shibboleth.shared.component.ComponentInitializationException;
@@ -480,12 +482,12 @@ public class ScriptedAttributeTest extends XMLObjectBaseTestCase {
         
     }
 
-    @Test public void examples() throws ScriptException, IOException, ComponentInitializationException {
+    @Test public void examples() throws ScriptException, IOException, ComponentInitializationException, NoSuchAlgorithmException {
 
         IdPAttribute attribute = runExample("example1.script", "example1.attribute.xml", "swissEduPersonUniqueID");
 
         assertEquals(((StringAttributeValue)attribute.getValues().iterator().next()).getValue(),
-                DigestUtils.md5Hex("12345678some#salt#value#12345679") + "@switch.ch");
+                new StringDigester("SHA1", OutputFormat.BASE32).apply("12345678some#salt#value#12345679") + "@switch.ch");
 
         attribute = runExample("example2.script", "example2.attribute.xml", "eduPersonAffiliation");
         HashSet<IdPAttributeValue> set = new HashSet<>(attribute.getValues());
diff --git a/shib-attribute-resolver-impl/src/test/resources/net/shibboleth/idp/attribute/resolver/impl/ad/example1.script b/shib-attribute-resolver-impl/src/test/resources/net/shibboleth/idp/attribute/resolver/impl/ad/example1.script
index 32f29ab6e..76c94d721 100644
--- a/shib-attribute-resolver-impl/src/test/resources/net/shibboleth/idp/attribute/resolver/impl/ad/example1.script
+++ b/shib-attribute-resolver-impl/src/test/resources/net/shibboleth/idp/attribute/resolver/impl/ad/example1.script
@@ -3,15 +3,14 @@ load('nashorn:mozilla_compat.js')
 // Import Shibboleth attribute provider
 importPackage(Packages.edu.internet2.middleware.shibboleth.common.attribute.provider);
  
-// Import Apache commons codecs
-importPackage(Packages.org.apache.commons.codec.digest);
+// Import our digester.
+importPackage(Packages.net.shibboleth.shared.codec);
  
 // Get the unique value
 uniqueValue = uidNumber.getValues().get(0) + "some#salt#value#12345679";
  
 // Create md5 value
-localpart = DigestUtils.md5Hex(uniqueValue);
- 
+localpart = new StringDigester("SHA1", StringDigester.OutputFormat.BASE32).apply(uniqueValue);
  
 // Prepend unique and pseudo-random localpart to domain name
 swissEduPersonUniqueID.getValues().add(localpart + "@switch.ch");
\ 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