dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06425
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2043: Fixed login success/failure logging (Bug #578503)
------------------------------------------------------------
revno: 2043
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-06-25 17:01:58 +0200
message:
Fixed login success/failure logging (Bug #578503)
modified:
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/listener/AuthenticationListener.java
dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-06-23 17:50:25 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-06-25 15:01:58 +0000
@@ -1348,13 +1348,12 @@
<bean id="authenticationManager"
class="org.springframework.security.authentication.ProviderManager">
- <property name="providers">
- <list>
- <ref local="daoAuthenticationProvider"/>
- </list>
- </property>
+ <property name="providers" ref="daoAuthenticationProvider"/>
+ <property name="authenticationEventPublisher" ref="defaultAuthenticationEventPublisher" />
</bean>
+ <bean id="defaultAuthenticationEventPublisher" class="org.springframework.security.authentication.DefaultAuthenticationEventPublisher" />
+
<bean id="daoAuthenticationProvider"
class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
<property name="userDetailsService" ref="userDetailsService"/>
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/listener/AuthenticationListener.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/listener/AuthenticationListener.java 2010-05-10 18:08:02 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/listener/AuthenticationListener.java 2010-06-25 15:01:58 +0000
@@ -28,11 +28,13 @@
*/
import org.hisp.dhis.useraudit.UserAuditService;
+import org.springframework.beans.factory.annotation.Required;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.security.authentication.event.AbstractAuthenticationFailureEvent;
import org.springframework.security.authentication.event.AuthenticationSuccessEvent;
import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.util.Assert;
/**
* @author Lars Helge Overland
@@ -42,6 +44,7 @@
{
private UserAuditService userAuditService;
+ @Required
public void setUserAuditService( UserAuditService userAuditService )
{
this.userAuditService = userAuditService;
@@ -49,13 +52,15 @@
public void onApplicationEvent( ApplicationEvent applicationEvent )
{
- if ( applicationEvent != null && applicationEvent instanceof AuthenticationSuccessEvent )
+ Assert.notNull( applicationEvent );
+
+ if ( applicationEvent instanceof AuthenticationSuccessEvent )
{
AuthenticationSuccessEvent event = (AuthenticationSuccessEvent) applicationEvent;
userAuditService.registerLoginSuccess( ((UserDetails) event.getAuthentication().getPrincipal()).getUsername() );
}
- else if ( applicationEvent != null && applicationEvent instanceof AbstractAuthenticationFailureEvent )
+ else if ( applicationEvent instanceof AbstractAuthenticationFailureEvent )
{
AbstractAuthenticationFailureEvent event = (AbstractAuthenticationFailureEvent) applicationEvent;
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2010-06-19 17:11:55 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2010-06-25 15:01:58 +0000
@@ -277,7 +277,7 @@
class="org.springframework.security.web.context.HttpSessionContextIntegrationFilter" />
<bean id="authenticationProcessingFilter"
- class="org.springframework.security.web.authentication.AuthenticationProcessingFilter">
+ class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
<property name="authenticationManager" ref="authenticationManager" />
<property name="authenticationFailureHandler" ref="failureHandler" />
<property name="authenticationSuccessHandler" ref="successHandler" />