X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fusermanager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fusermanager%2Fsecurity%2FSessionManager.java;h=21d013784973a8c49457a20d171abbc3b38dace0;hb=refs%2Fchanges%2F49%2F449%2F1;hp=bbad9eb2cad113355257f6ed5a90d53a7c2118e4;hpb=29f7cfb54b580928c7feac63abce028a7014b0d5;p=controller.git diff --git a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java index bbad9eb2ca..21d0137849 100644 --- a/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java +++ b/opendaylight/usermanager/src/main/java/org/opendaylight/controller/usermanager/security/SessionManager.java @@ -24,7 +24,6 @@ import javax.servlet.http.HttpSessionEvent; import org.opendaylight.controller.usermanager.ISessionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.security.core.context.SecurityContext; public class SessionManager implements ISessionManager { @@ -32,7 +31,6 @@ public class SessionManager implements ISessionManager { .getLogger(SessionManager.class); private Map> sessionMap = new HashMap>(); - public static final String SPRING_SECURITY_CONTEXT_KEY = "SPRING_SECURITY_CONTEXT"; @Override public void sessionCreated(HttpSessionEvent se) { @@ -40,8 +38,9 @@ public class SessionManager implements ISessionManager { ServletContext ctx = se.getSession().getServletContext(); String path = ctx.getContextPath(); - logger.debug("Servlet Context Path created " + path); - logger.debug("Session Id created for ctxt path " + se.getSession().getId()); + logger.debug("Servlet Context Path created {}", path); + logger.debug("Session Id created for ctxt path {}", + se.getSession().getId()); synchronized (sessionMap) { Set set = sessionMap.get(ctx); @@ -57,8 +56,8 @@ public class SessionManager implements ISessionManager { public void sessionDestroyed(HttpSessionEvent se) { ServletContext ctx = se.getSession().getServletContext(); String path = ctx.getContextPath(); - logger.debug("Servlet Context Path of destroyed session - " + path); - logger.debug("Session Id destroyed " + se.getSession().getId()); + logger.debug("Servlet Context Path of destroyed session - {}", path); + logger.debug("Session Id destroyed {}", se.getSession().getId()); synchronized (sessionMap) { Set set = sessionMap.get(ctx); @@ -84,22 +83,8 @@ public class SessionManager implements ISessionManager { while (sessIterator.hasNext()) { HttpSession session = sessIterator.next(); if (session != null && sessionId != null && session.getId() != null && !session.getId().equals(sessionId)) { - Object contextFromSession = session - .getAttribute(SPRING_SECURITY_CONTEXT_KEY); - if (contextFromSession != null - && contextFromSession instanceof SecurityContext) { - String storedUserName = ((SecurityContext) contextFromSession) - .getAuthentication().getName(); - if (storedUserName != null && storedUserName.equals(username)) { - sessionsList.add(session); - sessIterator.remove(); - } - else { - logger.debug("storedUserName is null or did not match username " + username); - } - } else { - logger.debug("contextFromSession is null or not instance of SecurityContext"); - } + sessionsList.add(session); + sessIterator.remove(); } else { logger.debug(" session or sessionId is null ");