public boolean isLoggedIn(HttpServletRequest request, HttpServletResponse response) throws Exception {
        if (request.getSession() != null && request.getSession().getAttribute(Constants.Session.CURRENT_USER) != null) {
            return true;
        } else {
            Cookie authCookie = CookieUtils.getCookie(request, Constants.Cookie.AUTH_COOKIE);
            String decodedAuthCookieValue = decodeAuthCookieSafely(authCookie);
            if (!StringUtils.isEmpty(decodedAuthCookieValue)) {
                User user = storage.find(decodedAuthCookieValue);
                if (user != null) {
                    request.getSession(true).setAttribute(Constants.Session.CURRENT_USER, user);
                    CookieUtils.createLoginCookie(response, user);
                    return true;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        }
    }