static int login(Scanner scanner, ObjectOutputStream toServer, ObjectInputStream fromServer) throws
            IOException, ClassNotFoundException {
        log.debug("Start \"login\" method");
        System.out.println("Input login:");
        String login = scanner.next().toLowerCase();
        System.out.println("Input password:");
        String password = scanner.next();
        AuthorizationRequestInfo auth = new AuthorizationRequestInfo(login, password);
        log.debug("Send AuthorizationRequestInfo to server");
        toServer.writeObject(auth);

        Object o = fromServer.readObject();
        if (o instanceof RespondInfo) {
            if (((RespondInfo) o).getStatus() == RespondInfo.SERVER_ERROR_STATUS) {
                System.out.println("Server error");
                log.debug("Server error");
                return SERVER_ERROR_RETURN_CODE;
            } else if (o instanceof AuthorizationRespondInfo) {
                AuthorizationRespondInfo respond = (AuthorizationRespondInfo) o;
                log.debug("Received AuthorizationRespondInfo from server");

                switch (respond.getStatus()) {
                    case AuthorizationRespondInfo.OK_STATUS: {
                        System.out.println("Connected");
                        log.debug("Authorized");
                        return respond.getRights();
                    }
                    case AuthorizationRespondInfo.WRONG_CREDENTIALS_STATUS: {
                        System.out.println("Wrong login/password provided");
                        log.debug("Wrong login/password provided");
                        break;
                    }
                }
            }
            System.out.println("Login failed!!!");
            log.debug("Login failed!!!");
            return LOGIN_FAILED_RETURN_CODE;
        }
        log.error("Unknown object type");
        return SERVER_ERROR_RETURN_CODE;
    }