- Timestamp:
- Sep 7, 2011, 4:32:20 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
EDIS/trunk/java/tracking-server-core/src/main/java/gov/va/med/edp/web/servlet/listener/TimeOutIntegrationSessionAttributeListener.java
r1227 r1236 1 1 package gov.va.med.edp.web.servlet.listener; 2 2 3 import gov.va.med.authentication.kernel.LoginUserInfoVO;4 3 import gov.va.med.edp.dao.SessionDao; 4 import gov.va.med.edp.springframework.security.userdetails.VistaUserDetails; 5 5 import gov.va.med.edp.vo.SessionVO; 6 6 import gov.va.med.edp.web.controller.SessionConstants; 7 7 import org.apache.commons.logging.Log; 8 8 import org.apache.commons.logging.LogFactory; 9 import org.springframework.security.context.HttpSessionContextIntegrationFilter; 10 import org.springframework.security.context.SecurityContext; 9 11 import org.springframework.web.context.WebApplicationContext; 10 12 import org.springframework.web.context.support.WebApplicationContextUtils; … … 20 22 21 23 public void attributeAdded(HttpSessionBindingEvent event) { 22 if (!event.getName().equals( LoginUserInfoVO.SESSION_KEY)) return;24 if (!event.getName().equals(HttpSessionContextIntegrationFilter.SPRING_SECURITY_CONTEXT_KEY)) return; 23 25 24 26 setTimeOut(event); … … 26 28 27 29 public void attributeRemoved(HttpSessionBindingEvent event) { 28 if (!event.getName().equals( LoginUserInfoVO.SESSION_KEY)) return;30 if (!event.getName().equals(HttpSessionContextIntegrationFilter.SPRING_SECURITY_CONTEXT_KEY)) return; 29 31 } 30 32 31 33 public void attributeReplaced(HttpSessionBindingEvent event) { 32 if (!event.getName().equals( LoginUserInfoVO.SESSION_KEY)) return;34 if (!event.getName().equals(HttpSessionContextIntegrationFilter.SPRING_SECURITY_CONTEXT_KEY)) return; 33 35 34 36 setTimeOut(event); … … 36 38 37 39 private void setTimeOut(HttpSessionBindingEvent event) { 38 LoginUserInfoVO userInfo = (LoginUserInfoVO) event.getValue(); 40 SecurityContext securityContext = (SecurityContext) event.getValue(); 41 VistaUserDetails userInfo = (VistaUserDetails) securityContext.getAuthentication().getPrincipal(); 39 42 40 43 try { … … 42 45 SessionDao dao = (SessionDao) ac.getBean(SESSION_DAO_BEAN_NAME, SessionDao.class); 43 46 44 SessionVO sessionInfo = dao.getSessionInfo(userInfo.getLoginStationNumber(), userInfo.get UserDuz());47 SessionVO sessionInfo = dao.getSessionInfo(userInfo.getLoginStationNumber(), userInfo.getDuz()); 45 48 46 49 String serverPackageVersion = sessionInfo.getServerPackageVersion(); … … 50 53 int timeOut = sessionInfo.getMaxInactiveInterval(); 51 54 event.getSession().setMaxInactiveInterval(timeOut); 52 if (log.isDebugEnabled()) log.debug("set timeout for user " + userInfo.get UserDuz() + " to " + timeOut + " seconds.");55 if (log.isDebugEnabled()) log.debug("set timeout for user " + userInfo.getDuz() + " to " + timeOut + " seconds."); 53 56 } catch (DataAccessException e) { 54 57 log.error("unable to fetch session info", e);
Note:
See TracChangeset
for help on using the changeset viewer.