code: public static void clearSession(HttpServletRequest req) {
  		SecurityContextHolder.clearContext();
  		if (req != null) {
  			HttpSession session = req.getSession(false);
  			if (session != null) {
  				session.invalidate();
  			}
  		}
  	}
docs: Clears the session. Deletes cookies and clears the security context.
  @param req HTTP request