← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9126: Add username in httpsession after login for logging

 

------------------------------------------------------------
revno: 9126
committer: Saptarshi <sunbiz@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-11-26 11:47:25 +0100
message:
  Add username in httpsession after login for logging
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/DefaultAuthenticationSuccessHandler.java


--
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-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/DefaultAuthenticationSuccessHandler.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/DefaultAuthenticationSuccessHandler.java	2011-12-27 13:25:50 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/DefaultAuthenticationSuccessHandler.java	2012-11-26 10:47:25 +0000
@@ -36,6 +36,7 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 import java.io.IOException;
+import org.springframework.security.core.userdetails.User;
 
 /**
  * Since ActionContext is not available at this point, we set a mark in the
@@ -59,6 +60,7 @@
     {
         HttpSession session = request.getSession();
 
+        session.setAttribute( "userIs", ((User)authentication.getPrincipal()).getUsername());
         session.setAttribute( LoginInterceptor.JLI_SESSION_VARIABLE, Boolean.TRUE );
         session.setMaxInactiveInterval( DefaultAuthenticationSuccessHandler.DEFAULT_SESSION_TIMEOUT );