Class SecureFilteringClassLoader


  • public class SecureFilteringClassLoader
    extends ClassLoader
    A class loader that uses a allow list and a deny list of classes that it will allow to resolve. This is useful for providing proper sandboxing to scripting engine such as MVEL, OGNL or Groovy.
    • Constructor Detail

      • SecureFilteringClassLoader

        public SecureFilteringClassLoader​(ClassLoader delegate)
        Sets up the securing filtering class loader, using the default allowed and forbidden classes. By default the
        Parameters:
        delegate - the class loader we delegate to if the filtering was not applied.
      • SecureFilteringClassLoader

        public SecureFilteringClassLoader​(Set<String> allowedClasses,
                                          Set<String> forbiddenClasses,
                                          ClassLoader delegate)
        Sets up the secure filtering class loader
        Parameters:
        allowedClasses - the list of allowed FQN class names, or if this filtering is to be deactivated, pass null. if you want to allow no class, pass an empty hashset
        forbiddenClasses - the list of forbidden FQN class names, or if this filtering is to be deactivated, pass null or an empty set
        delegate - the class loader we delegate to if the filtering was not applied.