code: public static <ResType> Iterable<ResType> filterAuthorizedResources(
        final HttpServletRequest request,
        final Iterable<ResType> resources,
        final Function<? super ResType, Iterable<ResourceAction>> resourceActionGenerator,
        final AuthorizerMapper authorizerMapper
    )
    {
      if (request.getAttribute(AuthConfig.DRUID_ALLOW_UNSECURED_PATH) != null) {
        return resources;
      }
  
      if (request.getAttribute(AuthConfig.DRUID_AUTHORIZATION_CHECKED) != null) {
        throw new ISE("Request already had authorization check.");
      }
  
      final AuthenticationResult authenticationResult = authenticationResultFromRequest(request);
  
      final Iterable<ResType> filteredResources = filterAuthorizedResources(
          authenticationResult,
          resources,
          resourceActionGenerator,
          authorizerMapper
      );
  
      // We're filtering, so having access to none of the objects isn't an authorization failure (in terms of whether
      // to send an error response or not.)
      request.setAttribute(AuthConfig.DRUID_AUTHORIZATION_CHECKED, true);
  
      return filteredResources;
    }
docs: Filter a collection of resources by applying the resourceActionGenerator to each resource, return an iterable
  containing the filtered resources.
  
  The resourceActionGenerator returns an Iterable<ResourceAction> for each resource.
  
  If every resource-action in the iterable is authorized, the resource will be added to the filtered resources.
  
  If there is an authorization failure for one of the resource-actions, the resource will not be
  added to the returned filtered resources..
  
  If the resourceActionGenerator returns null for a resource, that resource will not be added to the filtered
  resources.
  
  This function will set the DRUID_AUTHORIZATION_CHECKED attribute in the request.
  
  If this attribute is already set when this function is called, an exception is thrown.
  
  @param request                 HTTP request to be authorized
  @param resources               resources to be processed into resource-actions
  @param resourceActionGenerator Function that creates an iterable of resource-actions from a resource
  @param authorizerMapper        authorizer mapper
  
  @return Iterable containing resources that were authorized