Changeset 1236 for EDIS/trunk/java


Ignore:
Timestamp:
Sep 7, 2011, 4:32:20 AM (13 years ago)
Author:
Solomon Blaz
Message:

removed dependencies on KAAJEE

Location:
EDIS/trunk/java/tracking-server-core/src/main/java/gov/va/med/edp/web
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • EDIS/trunk/java/tracking-server-core/src/main/java/gov/va/med/edp/web/controller/TrackingController.java

    r1227 r1236  
    11package gov.va.med.edp.web.controller;
    22
    3 import gov.va.med.authentication.kernel.LoginUserInfoVO;
    43import gov.va.med.edp.dao.ServerPackageVersionDao;
    54import gov.va.med.edp.dao.TrackingDao;
     5import gov.va.med.edp.springframework.security.userdetails.VistaUserDetails;
    66import gov.va.med.edp.vo.BigBoardDebugInfoVO;
    77import gov.va.med.edp.web.view.XmlView;
    88import org.springframework.beans.factory.InitializingBean;
     9import org.springframework.security.context.SecurityContextHolder;
    910import org.springframework.util.Assert;
    1011import org.springframework.util.StringUtils;
     
    3738    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
    3839        validateSwfID(request);
    39         LoginUserInfoVO userInfo = getUserInfo(request);
    40         String result = trackingDao.executeCommand(userInfo.getLoginStationNumber(), userInfo.getUserDuz(), buildParameterMap(request));
     40        VistaUserDetails userInfo = getUserInfo(request);
     41        String result = trackingDao.executeCommand(userInfo.getLoginStationNumber(), userInfo.getDuz(), buildParameterMap(request));
    4142        if (isInitDisplayBoardCommand(request))
    4243        result = appendSiteAndVistaLinkConnectionInfo(result, request);
     
    6263    }   
    6364   
    64     protected LoginUserInfoVO getUserInfo(HttpServletRequest request) throws NoUserInfoInSessionException {
    65         LoginUserInfoVO userInfo = (LoginUserInfoVO) request.getSession().getAttribute(LoginUserInfoVO.SESSION_KEY);
     65    protected VistaUserDetails getUserInfo(HttpServletRequest request) throws NoUserInfoInSessionException {
     66        VistaUserDetails userInfo = (VistaUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    6667        if (userInfo == null) throw new NoUserInfoInSessionException();
    6768        return userInfo;
  • EDIS/trunk/java/tracking-server-core/src/main/java/gov/va/med/edp/web/servlet/listener/TimeOutIntegrationSessionAttributeListener.java

    r1227 r1236  
    11package gov.va.med.edp.web.servlet.listener;
    22
    3 import gov.va.med.authentication.kernel.LoginUserInfoVO;
    43import gov.va.med.edp.dao.SessionDao;
     4import gov.va.med.edp.springframework.security.userdetails.VistaUserDetails;
    55import gov.va.med.edp.vo.SessionVO;
    66import gov.va.med.edp.web.controller.SessionConstants;
    77import org.apache.commons.logging.Log;
    88import org.apache.commons.logging.LogFactory;
     9import org.springframework.security.context.HttpSessionContextIntegrationFilter;
     10import org.springframework.security.context.SecurityContext;
    911import org.springframework.web.context.WebApplicationContext;
    1012import org.springframework.web.context.support.WebApplicationContextUtils;
     
    2022
    2123    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;
    2325
    2426        setTimeOut(event);
     
    2628
    2729    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;
    2931    }
    3032
    3133    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;
    3335
    3436        setTimeOut(event);
     
    3638
    3739    private void setTimeOut(HttpSessionBindingEvent event) {
    38         LoginUserInfoVO userInfo = (LoginUserInfoVO) event.getValue();
     40        SecurityContext securityContext = (SecurityContext) event.getValue();
     41        VistaUserDetails userInfo = (VistaUserDetails) securityContext.getAuthentication().getPrincipal();
    3942
    4043        try {
     
    4245            SessionDao dao = (SessionDao) ac.getBean(SESSION_DAO_BEAN_NAME, SessionDao.class);
    4346
    44             SessionVO sessionInfo = dao.getSessionInfo(userInfo.getLoginStationNumber(), userInfo.getUserDuz());
     47            SessionVO sessionInfo = dao.getSessionInfo(userInfo.getLoginStationNumber(), userInfo.getDuz());
    4548
    4649            String serverPackageVersion = sessionInfo.getServerPackageVersion();
     
    5053            int timeOut = sessionInfo.getMaxInactiveInterval();
    5154            event.getSession().setMaxInactiveInterval(timeOut);
    52             if (log.isDebugEnabled()) log.debug("set timeout for user " + userInfo.getUserDuz() + " to " + timeOut + " seconds.");
     55            if (log.isDebugEnabled()) log.debug("set timeout for user " + userInfo.getDuz() + " to " + timeOut + " seconds.");
    5356        } catch (DataAccessException e) {
    5457            log.error("unable to fetch session info", e);
Note: See TracChangeset for help on using the changeset viewer.