@Override public void removeCookie(String path, String name) { delegate.removeCookie(path, name); } }
/** * Removes the cookie. * * @param name name of the cookie */ public void removeCookie(String name) { removeCookie(null, name); }
@Override public void removeCookie(String name) { delegate.removeCookie(name); }
/** * Removes the cookie. * * @param name name of the cookie */ public void removeCookie(String name) { removeCookie(null, name); }
@Override public void removeCookie(String name) { delegate.removeCookie(name); } }
@Override public void removeCookie(String name) { delegate.removeCookie(name); }
@Override public void removeCookie(String path, String name) { delegate.removeCookie(path, name); } }
/** * Checks user cookies and seee if he is allowed to login * * @return ok, if he is allowed to see what he's trying to see */ public boolean checkSession(Request req, Response res) { try { Settings useAuth = get(Settings.USE_AUTH); if (useAuth != null && useAuth.getValue().equalsIgnoreCase("1")) { logger.info("Auth requested, checking if everything is alright;"); //checking cookie first if (req.cookies().containsKey(AUTH_KEY)) { return checkPassword(req.cookie(AUTH_KEY)); } else if (req.session().attribute(AUTH_KEY) != null) { return checkPassword(req.session().attribute(AUTH_KEY)); } else { res.removeCookie(AUTH_KEY); req.session().removeAttribute(AUTH_KEY); return false; } } return true; } catch (Exception e) { return false; } }
public void defineEndpoints() { /** * Settings page */ Spark.get("/settings", this::getSettingsPage, new HomeDashTemplateEngine()); Spark.post("/settings", this::saveSettings); /** * Login form */ Spark.get("/login", (req, res) -> new ModelAndView(new HashMap<String, String>(), "login"), new HomeDashTemplateEngine()); Spark.post("/login", this::login, new HomeDashTemplateEngine()); Spark.get("/export-config", this::exportConfig); /** * Loging out ! */ Spark.get("/logout", (req, res) -> { res.removeCookie(AUTH_KEY); req.session().removeAttribute(AUTH_KEY); res.redirect("/"); return null; }); }
response.removeCookie( GlobalState.HTTP_AUTH_TOKEN_COOKIE); response.status(401);