|
@@ -86,23 +86,22 @@ public class LdapAuthenticationProviderTests extends TestCase {
|
|
} catch (BadCredentialsException expected) {}
|
|
} catch (BadCredentialsException expected) {}
|
|
}
|
|
}
|
|
|
|
|
|
- public void testEmptyPasswordIsAcceptedByDefault() {
|
|
|
|
|
|
+ public void testEmptyPasswordIsRejectedByDefault() {
|
|
LdapAuthenticationProvider ldapProvider = new LdapAuthenticationProvider(new MockAuthenticator(),
|
|
LdapAuthenticationProvider ldapProvider = new LdapAuthenticationProvider(new MockAuthenticator(),
|
|
new MockAuthoritiesPopulator());
|
|
new MockAuthoritiesPopulator());
|
|
- ldapProvider.retrieveUser("jen", new UsernamePasswordAuthenticationToken("jen", ""));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void testEmptyPasswordIsRejectedWhenFlagIsSet() {
|
|
|
|
- LdapAuthenticationProvider ldapProvider = new LdapAuthenticationProvider(new MockAuthenticator(),
|
|
|
|
- new MockAuthoritiesPopulator());
|
|
|
|
- ldapProvider.setAllowEmptyPasswords(false);
|
|
|
|
-
|
|
|
|
try {
|
|
try {
|
|
ldapProvider.retrieveUser("jen", new UsernamePasswordAuthenticationToken("jen", ""));
|
|
ldapProvider.retrieveUser("jen", new UsernamePasswordAuthenticationToken("jen", ""));
|
|
fail("Expected BadCredentialsException for empty password");
|
|
fail("Expected BadCredentialsException for empty password");
|
|
} catch (BadCredentialsException expected) {}
|
|
} catch (BadCredentialsException expected) {}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void testEmptyPasswordIsAcceptedWhenFlagIsSet() {
|
|
|
|
+ LdapAuthenticationProvider ldapProvider = new LdapAuthenticationProvider(new MockAuthenticator(),
|
|
|
|
+ new MockAuthoritiesPopulator());
|
|
|
|
+ ldapProvider.setAllowEmptyPasswords(true);
|
|
|
|
+ ldapProvider.retrieveUser("jen", new UsernamePasswordAuthenticationToken("jen", ""));
|
|
|
|
+ }
|
|
|
|
+
|
|
public void testNormalUsage() {
|
|
public void testNormalUsage() {
|
|
LdapAuthenticationProvider ldapProvider = new LdapAuthenticationProvider(new MockAuthenticator(),
|
|
LdapAuthenticationProvider ldapProvider = new LdapAuthenticationProvider(new MockAuthenticator(),
|
|
new MockAuthoritiesPopulator());
|
|
new MockAuthoritiesPopulator());
|