class RegExMethodAuthorizer implements MethodInvocationAuthorizer {

  @Override
  public boolean authorize(Method method, Object target) {
    // Return false for known dangerous methods.
    if (restrictedMethodAuthorizer.isPermanentlyForbiddenMethod(method, target)) {
      return false;
    }

    // If the target object belongs to Geode, make sure the method is considered safe.
    if (target.getClass().getPackage().getName().startsWith(GEODE_BASE_PACKAGE)) {
      return restrictedMethodAuthorizer.isAllowedGeodeMethod(method, target);
    }

    // Compare fully qualified method name against compiled expressions.
    String fullyQualifiedMethodName = target.getClass().getName() + "." + method.getName();
    if (compiledPatterns.stream()
        .anyMatch(pattern -> pattern.matcher(fullyQualifiedMethodName).matches())) {
      return true;
    }

    // Delegate to the default authorizer.
    return restrictedMethodAuthorizer.authorize(method, target);
  }

  public  RegExMethodAuthorizer(Cache cache, Set<String> allowedPatterns);
  public  RegExMethodAuthorizer(RestrictedMethodAuthorizer restrictedMethodAuthorizer,
      Set<String> allowedPatterns);

}