public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HttpSession session = request.getSession(true); String destination = (String) session .getAttribute(LoginConstants.DESTINATION); if (destination == null || destination.equals(request.getContextPath())) destination = request.getContextPath() + "/"; else session.removeAttribute(LoginConstants.DESTINATION); String username = (String)session.getAttribute(LoginConstants.USERNAME); session.removeAttribute(LoginConstants.USERNAME); session.removeAttribute(LoginConstants.PASSWORD); session.removeAttribute(LoginConstants.RETRYCOUNT); session.removeAttribute(PortalReservedParameters.PREFERED_LOCALE_ATTRIBUTE); ComponentManager cm = Jetspeed.getComponentManager(); UserContentCacheManager userContentCacheManager = cm.lookupComponent("userContentCacheManager"); userContentCacheManager.evictUserContentCache(username, session.getId()); AuditActivity audit = cm.lookupComponent("org.apache.jetspeed.audit.AuditActivity"); if (audit != null) { audit.logUserActivity(username, request.getRemoteAddr(), AuditActivity.AUTHENTICATION_SUCCESS, "Active Authentication"); } response.sendRedirect(response.encodeURL(destination)); }
public void sessionDestroyed(HttpSessionEvent se) { Subject subject = (Subject)se.getSession().getAttribute(PortalReservedParameters.SESSION_KEY_SUBJECT); if (subject == null) return; if (firstInit) { // Servlet already destroyed, // Can't reliably access ComponentManager (Spring) anymore // as for instance WAS 6.0.2 has a bug invoking this method with a wrong classLoader (not the one for the WebApp) return; } Principal subjectUserPrincipal = SubjectHelper.getPrincipal(subject, UserSubjectPrincipal.class); PortalStatistics statistics = engine.getComponentManager().lookupComponent("PortalStatistics"); long sessionLength = System.currentTimeMillis() - se.getSession().getCreationTime(); String ipAddress = (String)se.getSession().getAttribute(SecurityValve.IP_ADDRESS); statistics.logUserLogout(ipAddress, subjectUserPrincipal.getName(), sessionLength); UserContentCacheManager userContentCacheManager = engine.getComponentManager().lookupComponent("userContentCacheManager"); userContentCacheManager.evictUserContentCache(subjectUserPrincipal.getName(), se.getSession().getId()); // clear preferences cache PortletPreferencesProvider preferencesProvider = engine.getComponentManager().lookupComponent("portletPreferencesProvider"); if (preferencesProvider != null) { preferencesProvider.sessionDestroyedEvent(se.getSession()); } }
userContentCacheManager.evictUserContentCache(username, request.getSession().getId());
portalUserContentCacheManager.evictUserContentCache(portalUser.getName(), httpSession.getId());
userContentCacheManager.evictUserContentCache(username, request.getSession().getId());