浏览代码

Handle usernames that are empty Strings.

Ben Alex 21 年之前
父节点
当前提交
1b660d4d5b
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      core/src/main/java/org/acegisecurity/providers/dao/DaoAuthenticationProvider.java

+ 3 - 2
core/src/main/java/org/acegisecurity/providers/dao/DaoAuthenticationProvider.java

@@ -226,8 +226,9 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
                 if (this.context != null) {
                     context.publishEvent(new AuthenticationFailureUsernameNotFoundEvent(
                             authentication,
-                            new User(username, "*****", false,
-                                new GrantedAuthority[0])));
+                            new User("".equals(username)
+                                ? "EMPTY_STRING_PROVIDED" : username, "*****",
+                                false, new GrantedAuthority[0])));
                 }
 
                 throw ex;