mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-03-04 12:29:09 +00:00
Modified jaas sample's LoginModule to prevent empty string username/password
This commit is contained in:
parent
9e5d35235c
commit
a50c9afbab
@ -71,6 +71,9 @@ public class UsernameEqualsPasswordLoginModule implements LoginModule {
|
|||||||
if (username == null || !username.equals(password)) {
|
if (username == null || !username.equals(password)) {
|
||||||
throw new LoginException("username is not equal to password");
|
throw new LoginException("username is not equal to password");
|
||||||
}
|
}
|
||||||
|
if("".equals(username)) {
|
||||||
|
throw new LoginException("username cannot be empty string");
|
||||||
|
}
|
||||||
|
|
||||||
subject.getPrincipals().add(new UsernamePrincipal(username));
|
subject.getPrincipals().add(new UsernamePrincipal(username));
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user