List of usage examples for javax.servlet.http HttpSession invalidate
public void invalidate();
From source file:edu.emory.cci.aiw.cvrg.eureka.servlet.LoginServlet.java
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try {//from w w w . j a v a2 s. co m User user = (User) req.getAttribute("user"); user.setLastLogin(new Date()); this.servicesClient.updateUser(user, user.getId()); resp.sendRedirect(req.getContextPath() + "/index.jsp"); } catch (ClientException e) { Status responseStatus = e.getResponseStatus(); if (responseStatus == Status.FORBIDDEN) { HttpSession session = req.getSession(false); if (session != null) { session.invalidate(); } resp.sendError(HttpStatus.SC_FORBIDDEN); } else { throw new ServletException(e); } } }
From source file:simon.demo.core.controller.LoginAction.java
@RequestMapping(value = "login_loginout.do", method = RequestMethod.GET) public String loginout(HttpSession session) { session.invalidate(); return "login"; }
From source file:com.acme.demo.web.LogoutController.java
@RequestMapping(method = RequestMethod.GET) public void logout(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(false); if (request.isRequestedSessionIdValid() && session != null) { session.invalidate(); }// w ww . j av a 2 s. com handleLogOutResponse(request, response); }
From source file:net.firejack.platform.utils.SessionManager.java
/** * @param token// ww w .j av a 2 s .c o m */ public void logout(String token) { logger.debug("logout: token=" + token); HttpSession session = sessionsMap.remove(token); if (session != null) { session.invalidate(); logger.debug("logout invalidate: token=" + token); } }
From source file:th.co.geniustree.osgi.prototype.authen.security.DefaultLogoutSuccessHandler.java
private void invalidSessionAndRedirect(HttpSession session, HttpServletResponse response, String redirectUrl) throws IOException { try {/*from w w w . ja va 2 s.com*/ session.invalidate(); } catch (Exception ex) { //swallow exception ex.printStackTrace(); } finally { response.setStatus(HttpServletResponse.SC_OK); response.sendRedirect(redirectUrl); } }
From source file:ua.aits.oblenergo_site.controller.AjaxAndFormController.java
@RequestMapping(value = { "/system/logout.do", "/archive/logout.do/" }) public ModelAndView logout(HttpServletRequest request, HttpServletResponse response) throws Exception { request.setCharacterEncoding("UTF-8"); HttpSession session = request.getSession(false); if (session != null) { session.invalidate(); }/* w ww .j a va 2 s . c o m*/ return new ModelAndView("redirect:" + "/system/login"); }
From source file:com.leapfrog.springFramework.Controller.LoginController.java
@RequestMapping(value = "/logout", method = RequestMethod.GET) public String Logout(@RequestParam Map<String, String> parVal, HttpServletRequest request) { HttpSession session = request.getSession(false); session.invalidate(); return "redirect:" + "/home"; }
From source file:org.cloudfoundry.identity.uaa.authentication.SessionResetFilter.java
protected void handleRedirect(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpSession session = request.getSession(false); if (session != null) { session.invalidate(); }//from w ww . j ava 2 s .c o m strategy.sendRedirect(request, response, getRedirectUrl()); }
From source file:springku.BelajarController.java
@RequestMapping("/keluar") public String keluar(HttpServletRequest request) { HttpSession httpSession = request.getSession(); if (httpSession.getAttribute("username") != null) { httpSession.invalidate(); ;//from ww w.j a v a 2 s . c o m } return "redirect:formlogin"; }
From source file:pt.iflow.servlets.AuthenticationBICServlet.java
static AuthenticationResult authenticate(final HttpServletRequest request, final HttpServletResponse response, final String username, final String password, final String nextUrl) throws ServletException, IOException { AuthenticationResult result = new AuthenticationResult(); result.nextUrl = nextUrl;/*from w ww . j a va 2 s . c om*/ HttpSession session = request.getSession(); Boolean bIsSystem = (Boolean) session.getAttribute(ADMIN_SESSION_NAME); boolean isSystem = false; if (bIsSystem != null) isSystem = bIsSystem.booleanValue(); String login = username; if (login != null) { login = login.trim(); } boolean licenseOk = LicenseServiceFactory.getLicenseService().isLicenseOK(); AuthProfile ap = BeanFactory.getAuthProfileBean(); UserInfoInterface ui = null; if (isSystem) { ui = BeanFactory.getUserInfoFactory().newSystemUserInfo(); ui.login(login, password); } else { ui = new UserInfoBIC(); ((UserInfoBIC) ui).loginMultiAD(login, password); } // check license status if (!licenseOk && !isSystem) { result.nextUrl = "Admin/login.jsp"; session.invalidate(); return result; } boolean isAuth = result.isAuth = ui.isLogged(); if (isAuth) { ///////////////////////////// // // Now set some session vars // ///////////////////////////// //Application Data session.setAttribute("login", login); session.setAttribute(Const.USER_INFO, ui); UserSettings settings = ui.getUserSettings(); OrganizationData orgData = ap.getOrganizationInfo(ui.getOrganization()); session.setAttribute(Const.ORG_INFO, orgData); OrganizationTheme orgTheme = BeanFactory.getOrganizationThemeBean(); if (orgTheme != null) { OrganizationThemeData themeData = orgTheme.getOrganizationTheme(ui); session.setAttribute("themedata", themeData); } if (ui.isPasswordExpired()) { result.nextUrl = "changePassword"; } if (!isSystem && settings.isDefault() && Const.USE_INDIVIDUAL_LOCALE && Const.ASK_LOCALE_AT_LOGIN) { result.nextUrl = "setupUser"; } // check license status if (!licenseOk && isSystem) { result.nextUrl = "Admin/licenseValidation.jsp"; } session.setAttribute("SessionHelperToken", new SimpleSessionHelper()); } else { result.nextUrl = "main.jsp"; result.errorMsg = ui.getError(); session.setAttribute("login_error", result.errorMsg); } PersistSession ps = new PersistSession(); ps.getSession(ui, session); return result; }