1
0
mirror of synced 2026-08-07 10:47:49 +00:00

SEC-576: Add check for null pre-auth principal and return null if found.

This commit is contained in:
Luke Taylor
2008-01-31 14:50:12 +00:00
parent 5394350cc8
commit a305c9111f
2 changed files with 17 additions and 2 deletions
@@ -36,7 +36,14 @@ public class PreAuthenticatedAuthenticationProviderTests extends TestCase {
assertNull(result);
}
public final void testAuthenticateKnownUser() throws Exception {
public final void testNullPrincipalReturnsNullAuthentication() throws Exception {
PreAuthenticatedAuthenticationProvider provider = new PreAuthenticatedAuthenticationProvider();
Authentication request = new PreAuthenticatedAuthenticationToken(null, "dummyPwd");
Authentication result = provider.authenticate(request);
assertNull(result);
}
public final void testAuthenticateKnownUser() throws Exception {
UserDetails ud = new User("dummyUser", "dummyPwd", true, true, true, true, new GrantedAuthority[] {});
PreAuthenticatedAuthenticationProvider provider = getProvider(ud);
Authentication request = new PreAuthenticatedAuthenticationToken("dummyUser", "dummyPwd");