code: @Override
    public boolean proxyLoginHandler(String target, HttpServletRequest request, HttpServletResponse response) throws IOException {
      if (! isLoginTarget(target)) {
        return false;
      }
  
      if (isPageRequest(request)) {
        proxySendLoginForm(response);
      } else {
        response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Access denied. Please login.");
      }
      return true;
    }
docs: proxy login handler part