@Override
  public void configure(ResourceInfo resourceInfo, FeatureContext context) {
    Collection<String> requiredRoles = new ArrayList<>();
    Class<?> resourceClass = resourceInfo.getResourceClass();
    Method method = resourceInfo.getResourceMethod();

    if(resourceClass.isAnnotationPresent(RequiresRoles.class)) {
      requiredRoles.addAll(asList(resourceClass.getAnnotation(RequiresRoles.class).value()));
    }
    if(method.isAnnotationPresent(RequiresRoles.class)) {
      requiredRoles.addAll(asList(method.getAnnotation(RequiresRoles.class).value()));
    }

    // in case of Spring bean proxied by CGLIB (so without annotations)
    Class<?> superClass = resourceClass.getSuperclass();
    if(superClass.isAnnotationPresent(RequiresRoles.class)) {
      requiredRoles.addAll(asList(superClass.getAnnotation(RequiresRoles.class).value()));
    }
    if(isSuperMethodAnnotated(superClass, method, RequiresRoles.class)) {
      requiredRoles.addAll(asList(getSuperMethodAnnotation(superClass, method, RequiresRoles.class).value()));
    }

    if(!requiredRoles.isEmpty()) {
      log.debug("Register RequiresRolesRequestFilter for {} with {}", resourceInfo, requiredRoles);
      context.register(new RequiresRolesRequestFilter(requiredRoles));
    }
  }