Browse Source

Added a couple more tests.

1.0.x
Luke Taylor 20 years ago
parent
commit
f61a58d98b
  1. 11
      core/src/test/java/org/acegisecurity/providers/ldap/authenticator/LdapShaPasswordEncoderTests.java

11
core/src/test/java/org/acegisecurity/providers/ldap/authenticator/LdapShaPasswordEncoderTests.java

@ -36,6 +36,10 @@ public class LdapShaPasswordEncoderTests extends TestCase { @@ -36,6 +36,10 @@ public class LdapShaPasswordEncoderTests extends TestCase {
assertTrue(sha.isPasswordValid("{SHA}ddSFGmjXYPbZC+NXR2kCzBRjqiE=", "boabspasswurd", null));
}
public void testInvalidPasswordFails() {
assertFalse(sha.isPasswordValid("{SHA}ddSFGmjXYPbZC+NXR2kCzBRjqiE=", "wrongpassword", null));
}
/** Test values generated by 'slappasswd -s boabspasswurd' */
public void testValidSaltedPasswordSucceeds() {
assertTrue(sha.isPasswordValid("{SSHA}25ro4PKC8jhQZ26jVsozhX/xaP0suHgX", "boabspasswurd", null));
@ -46,4 +50,11 @@ public class LdapShaPasswordEncoderTests extends TestCase { @@ -46,4 +50,11 @@ public class LdapShaPasswordEncoderTests extends TestCase {
assertFalse(sha.isPasswordValid("{SSHA}25ro4PKC8jhQZ26jVsozhX/xaP0suHgX", "wrongpassword", null));
assertFalse(sha.isPasswordValid("{SSHA}PQy2j+6n5ytA+YlAKkM8Fh4p6u2JxfVd", "wrongpassword", null));
}
public void testNonByteArraySaltThrowsException() {
try {
sha.encodePassword("password", "AStringNotAByteArray");
} catch(IllegalArgumentException expected) {
}
}
}

Loading…
Cancel
Save