code: @Override
      public boolean handleSecurity(final HttpServletRequest request, final HttpServletResponse response)
              throws IOException {
  
          synchronized(authenticators) {
              // deny access if authMode is set to service but a service is not provided
              if (authenticators.isEmpty()) {
                  response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
                  return false;
              }
              for (final Authenticator authenticator : authenticators) {
                  boolean authenticated = authenticator.authenticate(request);
                  if (checkModeAny && authenticated) {
                      // One successful authenticator is good enough
                      return true;
                  }
                  else if (!checkModeAny && !authenticated) {
                      // All must succeed, so any negative respond will kill the authentication
                      response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
                      return false;
                  }
              }
              // if checkModeAny: Not a single succeeded, if checkModeAll: All have succeeded
              return !checkModeAny;
          }
      }
docs: {@inheritDoc}