瀏覽代碼

Add new AuthenticationFailure* events.

Ben Alex 20 年之前
父節點
當前提交
9176aa0efb
共有 1 個文件被更改,包括 22 次插入0 次删除
  1. 22 0
      core/src/main/java/org/acegisecurity/providers/dao/event/LoggerListener.java

+ 22 - 0
core/src/main/java/org/acegisecurity/providers/dao/event/LoggerListener.java

@@ -63,6 +63,28 @@ public class LoggerListener implements ApplicationListener {
             }
         }
 
+        if (event instanceof AuthenticationFailureCredentialsExpiredEvent) {
+            AuthenticationFailureCredentialsExpiredEvent authEvent = (AuthenticationFailureCredentialsExpiredEvent) event;
+
+            if (logger.isWarnEnabled()) {
+                logger.warn(
+                    "Authentication failed due to account credentials have been expired for user: "
+                    + authEvent.getUser().getUsername() + "; details: "
+                    + authEvent.getAuthentication().getDetails());
+            }
+        }
+
+        if (event instanceof AuthenticationFailureAccountExpiredEvent) {
+            AuthenticationFailureAccountExpiredEvent authEvent = (AuthenticationFailureAccountExpiredEvent) event;
+
+            if (logger.isWarnEnabled()) {
+                logger.warn(
+                    "Authentication failed due to account having expired for user: "
+                    + authEvent.getUser().getUsername() + "; details: "
+                    + authEvent.getAuthentication().getDetails());
+            }
+        }
+
         if (event instanceof AuthenticationFailureUsernameNotFoundEvent) {
             AuthenticationFailureUsernameNotFoundEvent authEvent = (AuthenticationFailureUsernameNotFoundEvent) event;