@@ -0,0 +1,1829 @@
+package ru.job4j.sj.servlets;%0A%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport ru.job4j.sj.models.User;%0Aimport ru.job4j.sj.store.IStorage;%0Aimport ru.job4j.sj.store.UserStore;%0A%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.http.HttpServlet;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0Aimport javax.servlet.http.HttpSession;%0Aimport java.io.IOException;%0A%0A/**%0A * @author Alexander Bondarev(mailto:bondarew2507@gmail.com).%0A * @since 11.03.2018.%0A */%0Apublic class SignInController extends HttpServlet %7B%0A%0A    private static final Logger LOG = LoggerFactory.getLogger(SignInController.class);%0A%0A    private final IStorage store = UserStore.getInstance();%0A%0A    @Override%0A    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException %7B%0A        req.getRequestDispatcher(%22/WEB-INF/views/SigninView.jsp%22).forward(req, resp);%0A    %7D%0A%0A    @Override%0A    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException %7B%0A        String login = req.getParameter(%22login%22);%0A        String password = req.getParameter(%22password%22);%0A%0A        if (!login.equals(%22%22) && !password.equals(%22%22)) %7B%0A            User user = this.store.get(login);%0A            if (user != null && user.getPassword().equals(password)) %7B%0A                HttpSession session = req.getSession();%0A                session.setAttribute(%22login%22, user.getLogin());%0A                resp.sendRedirect(String.format(%22%25s/%22, req.getContextPath()));%0A            %7D else %7B%0A                req.setAttribute(%22error%22, %22Invalid login or password%22);%0A                doGet(req, resp);%0A            %7D%0A        %7D else %7B%0A            req.setAttribute(%22error%22, %22You need fill all fields%22);%0A            doGet(req, resp);%0A        %7D%0A    %7D%0A%7D%0A

Implement authentication using filter. Task #2517