Jelajahi Sumber

SEC-70 and SEC-71: Refactor event publishing.

Ben Alex 20 tahun lalu
induk
melakukan
690ab27a52

+ 5 - 16
core/src/main/java/org/acegisecurity/ui/InteractiveAuthenticationSuccessEvent.java → core/src/main/java/org/acegisecurity/event/authentication/InteractiveAuthenticationSuccessEvent.java

@@ -13,12 +13,10 @@
  * limitations under the License.
  */
 
-package net.sf.acegisecurity.ui;
+package net.sf.acegisecurity.event.authentication;
 
 import net.sf.acegisecurity.Authentication;
 
-import org.springframework.context.ApplicationEvent;
-
 import org.springframework.util.Assert;
 
 
@@ -33,15 +31,16 @@ import org.springframework.util.Assert;
  * @author Ben Alex
  * @version $Id$
  */
-public class InteractiveAuthenticationSuccessEvent extends ApplicationEvent {
+public class InteractiveAuthenticationSuccessEvent
+    extends AbstractAuthenticationEvent {
     //~ Instance fields ========================================================
 
     private Class generatedBy;
 
     //~ Constructors ===========================================================
 
-    public InteractiveAuthenticationSuccessEvent(Authentication authentication,
-        Class generatedBy) {
+    public InteractiveAuthenticationSuccessEvent(
+        Authentication authentication, Class generatedBy) {
         super(authentication);
         Assert.notNull(generatedBy);
         this.generatedBy = generatedBy;
@@ -49,16 +48,6 @@ public class InteractiveAuthenticationSuccessEvent extends ApplicationEvent {
 
     //~ Methods ================================================================
 
-    /**
-     * Getters for the <code>Authentication</code> request that caused the
-     * event. Also available from <code>super.getSource()</code>.
-     *
-     * @return the authentication request
-     */
-    public Authentication getAuthentication() {
-        return (Authentication) super.getSource();
-    }
-
     /**
      * Getter for the <code>Class</code> that generated this event. This can be
      * useful for generating additional logging information.

+ 2 - 1
core/src/main/java/org/acegisecurity/ui/AbstractProcessingFilter.java

@@ -19,6 +19,7 @@ import net.sf.acegisecurity.Authentication;
 import net.sf.acegisecurity.AuthenticationException;
 import net.sf.acegisecurity.AuthenticationManager;
 import net.sf.acegisecurity.context.SecurityContextHolder;
+import net.sf.acegisecurity.event.authentication.InteractiveAuthenticationSuccessEvent;
 import net.sf.acegisecurity.ui.rememberme.NullRememberMeServices;
 import net.sf.acegisecurity.ui.rememberme.RememberMeServices;
 
@@ -118,7 +119,7 @@ import javax.servlet.http.HttpServletResponse;
  * 
  * <p>
  * If authentication is successful, an {@link
- * net.sf.acegisecurity.ui.InteractiveAuthenticationSuccessEvent} will be
+ * net.sf.acegisecurity.event.authentication.InteractiveAuthenticationSuccessEvent} will be
  * published to the application context. No events will be published if
  * authentication was unsuccessful, because this would generally be recorded
  * via an <code>AuthenticationManager</code>-specific application event.

+ 2 - 2
core/src/main/java/org/acegisecurity/ui/rememberme/RememberMeProcessingFilter.java

@@ -16,7 +16,7 @@
 package net.sf.acegisecurity.ui.rememberme;
 
 import net.sf.acegisecurity.context.SecurityContextHolder;
-import net.sf.acegisecurity.ui.InteractiveAuthenticationSuccessEvent;
+import net.sf.acegisecurity.event.authentication.InteractiveAuthenticationSuccessEvent;
 import net.sf.acegisecurity.Authentication;
 
 import org.apache.commons.logging.Log;
@@ -59,7 +59,7 @@ import javax.servlet.http.HttpServletResponse;
  * 
  * <p>
  * If authentication is successful, an {@link
- * net.sf.acegisecurity.ui.InteractiveAuthenticationSuccessEvent} will be
+ * net.sf.acegisecurity.event.authentication.InteractiveAuthenticationSuccessEvent} will be
  * published to the application context. No events will be published if
  * authentication was unsuccessful, because this would generally be recorded
  * via an <code>AuthenticationManager</code>-specific application event.

+ 2 - 2
core/src/main/java/org/acegisecurity/ui/x509/X509ProcessingFilter.java

@@ -19,9 +19,9 @@ import net.sf.acegisecurity.Authentication;
 import net.sf.acegisecurity.AuthenticationException;
 import net.sf.acegisecurity.AuthenticationManager;
 import net.sf.acegisecurity.context.SecurityContextHolder;
+import net.sf.acegisecurity.event.authentication.InteractiveAuthenticationSuccessEvent;
 import net.sf.acegisecurity.providers.x509.X509AuthenticationToken;
 import net.sf.acegisecurity.ui.AbstractProcessingFilter;
-import net.sf.acegisecurity.ui.InteractiveAuthenticationSuccessEvent;
 import net.sf.acegisecurity.ui.WebAuthenticationDetails;
 
 import org.apache.commons.logging.Log;
@@ -60,7 +60,7 @@ import javax.servlet.http.HttpServletResponse;
  * 
  * <p>
  * If authentication is successful, an {@link
- * net.sf.acegisecurity.ui.InteractiveAuthenticationSuccessEvent} will be
+ * net.sf.acegisecurity.event.authentication.InteractiveAuthenticationSuccessEvent} will be
  * published to the application context. No events will be published if
  * authentication was unsuccessful, because this would generally be recorded
  * via an <code>AuthenticationManager</code>-specific application event.