code: public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
          if (!authenticator.authenticate(request)) {
              response.setHeader("WWW-Authenticate",HttpServletRequest.BASIC_AUTH + " realm=\""+realm+"\"");
              response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
              return false;
          } else {
              return true;
          }
      }
docs: {@inheritDoc}