Introduce Single User login
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / internal / auth / AbstractLoginModule.java
index baf6b63175eb3b952bedee3cca530e2d00103196..89312a3dca2d1c7c95ee0df20875c6cd42e39a0b 100644 (file)
@@ -161,11 +161,13 @@ public abstract class AbstractLoginModule implements LoginModule {
                SecurityContextHolder.getContext().setAuthentication(null);
                if (Display.getCurrent() != null) {
                        HttpServletRequest httpRequest = RWT.getRequest();
-                       HttpSession httpSession = httpRequest.getSession();
-                       if (httpSession.getAttribute(SPRING_SECURITY_CONTEXT_KEY) != null)
-                               httpSession.setAttribute(SPRING_SECURITY_CONTEXT_KEY, null);
-                       // expire session
-                       httpSession.setMaxInactiveInterval(0);
+                       if (httpRequest != null) {
+                               HttpSession httpSession = httpRequest.getSession();
+                               if (httpSession.getAttribute(SPRING_SECURITY_CONTEXT_KEY) != null)
+                                       httpSession.setAttribute(SPRING_SECURITY_CONTEXT_KEY, null);
+                               // expire session
+                               httpSession.setMaxInactiveInterval(0);
+                       }
                }
                return true;
        }