Added a couple more tests.
This commit is contained in:
parent
7a0a87a167
commit
f61a58d98b
|
@ -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 {
|
|||
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…
Reference in New Issue