X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.enterprise%2Fext%2Ftest%2Forg%2Fargeo%2Fosgi%2Fuseradmin%2FLdifUserAdminTest.java;h=126125b8500f7a3c8c8b46a2e8ff783c42a196ac;hb=1a0d5ca243bc86a5f54448186178e5fb04c623e9;hp=1d6b0f3a5d80bcfef29b0af53b3e01fcd7066c1d;hpb=438237c2b8c995d4f9562d53bfe4ea63c4442054;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java b/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java index 1d6b0f3a5..126125b85 100644 --- a/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java +++ b/org.argeo.enterprise/ext/test/org/argeo/osgi/useradmin/LdifUserAdminTest.java @@ -5,13 +5,13 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URI; +import java.nio.charset.StandardCharsets; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.util.Arrays; -import java.util.Base64; import java.util.Dictionary; import java.util.Hashtable; import java.util.List; @@ -31,7 +31,7 @@ import junit.framework.TestCase; public class LdifUserAdminTest extends TestCase implements BasicTestConstants { // We have to keep using JUnit because of // https://issues.apache.org/jira/browse/SUREFIRE-1669 - + final static int TM_SIMPLE = 0; final static int TM_BITRONIX = 1; @@ -134,10 +134,10 @@ public class LdifUserAdminTest extends TestCase implements BasicTestConstants { assert "root@localhost".equals(rootUser.getProperties().get("mail")); // credentials - byte[] hashedPassword = ("{SHA}" + Base64.getEncoder().encodeToString(DigestUtils.sha1("demo".getBytes()))) - .getBytes(); - assert rootUser.hasCredential(LdapAttrs.userPassword.name(), hashedPassword); - assert demoUser.hasCredential(LdapAttrs.userPassword.name(), hashedPassword); + // {SHA} + assert rootUser.hasCredential(LdapAttrs.userPassword.name(), "demo".getBytes(StandardCharsets.UTF_8)); + // {PBKDF2_SHA256} + assert demoUser.hasCredential(LdapAttrs.userPassword.name(), "demo".getBytes(StandardCharsets.UTF_8)); // search Role[] search = userAdmin.getRoles(null);