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

This commit is contained in:
Ben Alex 2005-11-03 09:23:49 +00:00
parent b6dbfde55c
commit 690ab27a52
4 changed files with 11 additions and 21 deletions

View File

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

View File

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

View File

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

View File

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