@POST @Path("/logout") public Response logout() { Response response = redirect(rootPath); Cookie cookie = makeDefaultSessionCookie("", 0); response.headers().add(SET_COOKIE, ServerCookieEncoder.STRICT.encode(cookie)); return response; }
var configsLogic = new ConfigsLogic(holder, rootPath); var hardwareStatsLogic = new HardwareStatsLogic(holder, rootPath); var adminAuthHandler = new AdminAuthHandler(holder, rootPath); var authCookieHandler = new AuthCookieHandler(holder.sessionDao); var cookieBasedUrlReWriterHandler =
@POST @Consumes(value = MediaType.APPLICATION_FORM_URLENCODED) @Path("/login") public Response login(@FormParam("email") String email, @FormParam("password") String password) { if (email == null || password == null) { return redirect(rootPath); } User user = userDao.getByName(email, AppNameUtil.BLYNK); if (user == null || !user.isSuperAdmin) { return redirect(rootPath); } if (!password.equals(user.pass)) { return redirect(rootPath); } Response response = redirect(rootPath); log.debug("Admin login is successful. Redirecting to {}", rootPath); Cookie cookie = makeDefaultSessionCookie(sessionDao.generateNewSession(user), COOKIE_EXPIRE_TIME); response.headers().add(SET_COOKIE, ServerCookieEncoder.STRICT.encode(cookie)); return response; }