removed dependencies on KAAJEE

This commit is contained in:
sblaz 2011-09-07 08:32:20 +00:00
parent d6f3868081
commit a9386f18b1
2 changed files with 16 additions and 12 deletions

View File

@ -1,11 +1,12 @@
package gov.va.med.edp.web.controller;
import gov.va.med.authentication.kernel.LoginUserInfoVO;
import gov.va.med.edp.dao.ServerPackageVersionDao;
import gov.va.med.edp.dao.TrackingDao;
import gov.va.med.edp.springframework.security.userdetails.VistaUserDetails;
import gov.va.med.edp.vo.BigBoardDebugInfoVO;
import gov.va.med.edp.web.view.XmlView;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.ModelAndView;
@ -36,8 +37,8 @@ public class TrackingController extends AbstractController implements Initializi
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
validateSwfID(request);
LoginUserInfoVO userInfo = getUserInfo(request);
String result = trackingDao.executeCommand(userInfo.getLoginStationNumber(), userInfo.getUserDuz(), buildParameterMap(request));
VistaUserDetails userInfo = getUserInfo(request);
String result = trackingDao.executeCommand(userInfo.getLoginStationNumber(), userInfo.getDuz(), buildParameterMap(request));
if (isInitDisplayBoardCommand(request))
result = appendSiteAndVistaLinkConnectionInfo(result, request);
return createModelAndView(result);
@ -61,8 +62,8 @@ public class TrackingController extends AbstractController implements Initializi
this.serverPackageVersionDao = serverPackageVersionDao;
}
protected LoginUserInfoVO getUserInfo(HttpServletRequest request) throws NoUserInfoInSessionException {
LoginUserInfoVO userInfo = (LoginUserInfoVO) request.getSession().getAttribute(LoginUserInfoVO.SESSION_KEY);
protected VistaUserDetails getUserInfo(HttpServletRequest request) throws NoUserInfoInSessionException {
VistaUserDetails userInfo = (VistaUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if (userInfo == null) throw new NoUserInfoInSessionException();
return userInfo;
}

View File

@ -1,11 +1,13 @@
package gov.va.med.edp.web.servlet.listener;
import gov.va.med.authentication.kernel.LoginUserInfoVO;
import gov.va.med.edp.dao.SessionDao;
import gov.va.med.edp.springframework.security.userdetails.VistaUserDetails;
import gov.va.med.edp.vo.SessionVO;
import gov.va.med.edp.web.controller.SessionConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.security.context.HttpSessionContextIntegrationFilter;
import org.springframework.security.context.SecurityContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.dao.DataAccessException;
@ -19,29 +21,30 @@ public class TimeOutIntegrationSessionAttributeListener implements HttpSessionAt
private static final Log log = LogFactory.getLog(TimeOutIntegrationSessionAttributeListener.class);
public void attributeAdded(HttpSessionBindingEvent event) {
if (!event.getName().equals(LoginUserInfoVO.SESSION_KEY)) return;
if (!event.getName().equals(HttpSessionContextIntegrationFilter.SPRING_SECURITY_CONTEXT_KEY)) return;
setTimeOut(event);
}
public void attributeRemoved(HttpSessionBindingEvent event) {
if (!event.getName().equals(LoginUserInfoVO.SESSION_KEY)) return;
if (!event.getName().equals(HttpSessionContextIntegrationFilter.SPRING_SECURITY_CONTEXT_KEY)) return;
}
public void attributeReplaced(HttpSessionBindingEvent event) {
if (!event.getName().equals(LoginUserInfoVO.SESSION_KEY)) return;
if (!event.getName().equals(HttpSessionContextIntegrationFilter.SPRING_SECURITY_CONTEXT_KEY)) return;
setTimeOut(event);
}
private void setTimeOut(HttpSessionBindingEvent event) {
LoginUserInfoVO userInfo = (LoginUserInfoVO) event.getValue();
SecurityContext securityContext = (SecurityContext) event.getValue();
VistaUserDetails userInfo = (VistaUserDetails) securityContext.getAuthentication().getPrincipal();
try {
WebApplicationContext ac = getApplicationContext(event);
SessionDao dao = (SessionDao) ac.getBean(SESSION_DAO_BEAN_NAME, SessionDao.class);
SessionVO sessionInfo = dao.getSessionInfo(userInfo.getLoginStationNumber(), userInfo.getUserDuz());
SessionVO sessionInfo = dao.getSessionInfo(userInfo.getLoginStationNumber(), userInfo.getDuz());
String serverPackageVersion = sessionInfo.getServerPackageVersion();
if (log.isDebugEnabled()) log.debug("set server package version to '" + serverPackageVersion + "'");
@ -49,7 +52,7 @@ public class TimeOutIntegrationSessionAttributeListener implements HttpSessionAt
int timeOut = sessionInfo.getMaxInactiveInterval();
event.getSession().setMaxInactiveInterval(timeOut);
if (log.isDebugEnabled()) log.debug("set timeout for user " + userInfo.getUserDuz() + " to " + timeOut + " seconds.");
if (log.isDebugEnabled()) log.debug("set timeout for user " + userInfo.getDuz() + " to " + timeOut + " seconds.");
} catch (DataAccessException e) {
log.error("unable to fetch session info", e);
event.getSession().setAttribute(SessionConstants.SERVER_ERROR_KEY, e);