code: @Override
    public boolean loginHandler(String target, HttpServletRequest request, HttpServletResponse response) throws IOException {
      if (! isLoginTarget(target)) {
        return false;
      }
  
      if (isPageRequest(request)) {
        sendLoginForm(request, response);
      } else {
        ServletUtils.sendResponseError(response, HttpServletResponse.SC_UNAUTHORIZED, "Access denied. Please login.");
      }
      return true;
    }
docs: normal login handler part //todo: consider using mostly the same code as in proxy part below