From 50ac9d3b050e6f7fea8868c273db8394f66f83ac Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Sun, 26 Apr 2009 10:17:09 +0000 Subject: [PATCH] More generification to remove last warnings in core package. --- .../access/event/AuthorizationFailureEvent.java | 1 - .../security/access/event/LoggerListener.java | 6 ++---- .../authentication/AuthenticationDetailsSource.java | 4 ---- .../security/authentication/event/LoggerListener.java | 5 ++--- .../jaas/JaasAuthenticationProvider.java | 10 +++------- .../security/authentication/jaas/JaasEventCheck.java | 11 ++++------- 6 files changed, 11 insertions(+), 26 deletions(-) diff --git a/core/src/main/java/org/springframework/security/access/event/AuthorizationFailureEvent.java b/core/src/main/java/org/springframework/security/access/event/AuthorizationFailureEvent.java index e3d35ef8e3..5a4aa87fd8 100644 --- a/core/src/main/java/org/springframework/security/access/event/AuthorizationFailureEvent.java +++ b/core/src/main/java/org/springframework/security/access/event/AuthorizationFailureEvent.java @@ -17,7 +17,6 @@ package org.springframework.security.access.event; import java.util.List; -import org.springframework.security.access.AccessDecisionManager; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.ConfigAttribute; import org.springframework.security.core.Authentication; diff --git a/core/src/main/java/org/springframework/security/access/event/LoggerListener.java b/core/src/main/java/org/springframework/security/access/event/LoggerListener.java index 6ad35b0f98..f5aa69b746 100644 --- a/core/src/main/java/org/springframework/security/access/event/LoggerListener.java +++ b/core/src/main/java/org/springframework/security/access/event/LoggerListener.java @@ -17,8 +17,6 @@ package org.springframework.security.access.event; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - -import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; @@ -32,14 +30,14 @@ import org.springframework.context.ApplicationListener; * @author Ben Alex * @version $Id$ */ -public class LoggerListener implements ApplicationListener { +public class LoggerListener implements ApplicationListener { //~ Static fields/initializers ===================================================================================== private static final Log logger = LogFactory.getLog(LoggerListener.class); //~ Methods ======================================================================================================== - public void onApplicationEvent(ApplicationEvent event) { + public void onApplicationEvent(AbstractAuthorizationEvent event) { if (event instanceof AuthenticationCredentialsNotFoundEvent) { AuthenticationCredentialsNotFoundEvent authEvent = (AuthenticationCredentialsNotFoundEvent) event; diff --git a/core/src/main/java/org/springframework/security/authentication/AuthenticationDetailsSource.java b/core/src/main/java/org/springframework/security/authentication/AuthenticationDetailsSource.java index fee52c58aa..f879713545 100644 --- a/core/src/main/java/org/springframework/security/authentication/AuthenticationDetailsSource.java +++ b/core/src/main/java/org/springframework/security/authentication/AuthenticationDetailsSource.java @@ -15,10 +15,6 @@ package org.springframework.security.authentication; -import org.springframework.security.core.Authentication; - - - /** * Provides a {@link org.springframework.security.core.Authentication#getDetails()} object for * a given web request. diff --git a/core/src/main/java/org/springframework/security/authentication/event/LoggerListener.java b/core/src/main/java/org/springframework/security/authentication/event/LoggerListener.java index 9530608710..dc3b956406 100644 --- a/core/src/main/java/org/springframework/security/authentication/event/LoggerListener.java +++ b/core/src/main/java/org/springframework/security/authentication/event/LoggerListener.java @@ -17,7 +17,6 @@ package org.springframework.security.authentication.event; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; import org.springframework.util.ClassUtils; @@ -30,7 +29,7 @@ import org.springframework.util.ClassUtils; * @author Ben Alex * @version $Id$ */ -public class LoggerListener implements ApplicationListener { +public class LoggerListener implements ApplicationListener { //~ Static fields/initializers ===================================================================================== private static final Log logger = LogFactory.getLog(LoggerListener.class); @@ -40,7 +39,7 @@ public class LoggerListener implements ApplicationListener { //~ Methods ======================================================================================================== - public void onApplicationEvent(ApplicationEvent event) { + public void onApplicationEvent(AbstractAuthenticationEvent event) { if (event instanceof AbstractAuthenticationEvent) { AbstractAuthenticationEvent authEvent = (AbstractAuthenticationEvent) event; diff --git a/core/src/main/java/org/springframework/security/authentication/jaas/JaasAuthenticationProvider.java b/core/src/main/java/org/springframework/security/authentication/jaas/JaasAuthenticationProvider.java index 97e7776daf..5f0027a5cb 100644 --- a/core/src/main/java/org/springframework/security/authentication/jaas/JaasAuthenticationProvider.java +++ b/core/src/main/java/org/springframework/security/authentication/jaas/JaasAuthenticationProvider.java @@ -32,7 +32,6 @@ import javax.security.auth.login.LoginException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.InitializingBean; -import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.context.ApplicationListener; @@ -127,7 +126,7 @@ import org.springframework.util.Assert; * @version $Id$ */ public class JaasAuthenticationProvider implements AuthenticationProvider, ApplicationEventPublisherAware, - InitializingBean, ApplicationListener { + InitializingBean, ApplicationListener { //~ Static fields/initializers ===================================================================================== protected static final Log log = LogFactory.getLog(JaasAuthenticationProvider.class); @@ -339,11 +338,8 @@ public class JaasAuthenticationProvider implements AuthenticationProvider, Appli } } - public void onApplicationEvent(ApplicationEvent applicationEvent) { - if (applicationEvent instanceof SessionDestroyedEvent) { - SessionDestroyedEvent event = (SessionDestroyedEvent) applicationEvent; - handleLogout(event); - } + public void onApplicationEvent(SessionDestroyedEvent event) { + handleLogout(event); } /** diff --git a/core/src/test/java/org/springframework/security/authentication/jaas/JaasEventCheck.java b/core/src/test/java/org/springframework/security/authentication/jaas/JaasEventCheck.java index 5888350939..129bb06ff8 100644 --- a/core/src/test/java/org/springframework/security/authentication/jaas/JaasEventCheck.java +++ b/core/src/test/java/org/springframework/security/authentication/jaas/JaasEventCheck.java @@ -15,20 +15,17 @@ package org.springframework.security.authentication.jaas; +import org.springframework.context.ApplicationListener; +import org.springframework.security.authentication.jaas.event.JaasAuthenticationEvent; import org.springframework.security.authentication.jaas.event.JaasAuthenticationFailedEvent; import org.springframework.security.authentication.jaas.event.JaasAuthenticationSuccessEvent; -import org.springframework.context.ApplicationEvent; -import org.springframework.context.ApplicationListener; - /** - * DOCUMENT ME! - * * @author Ray Krueger * @version $Id$ */ -public class JaasEventCheck implements ApplicationListener { +public class JaasEventCheck implements ApplicationListener { //~ Instance fields ================================================================================================ JaasAuthenticationFailedEvent failedEvent; @@ -36,7 +33,7 @@ public class JaasEventCheck implements ApplicationListener { //~ Methods ======================================================================================================== - public void onApplicationEvent(ApplicationEvent event) { + public void onApplicationEvent(JaasAuthenticationEvent event) { if (event instanceof JaasAuthenticationFailedEvent) { failedEvent = (JaasAuthenticationFailedEvent) event; }