Enum Class SecurityMode

java.lang.Object
java.lang.Enum<SecurityMode>
pro.verron.officestamper.api.SecurityMode
All Implemented Interfaces:
Serializable, Comparable<SecurityMode>, Constable

public enum SecurityMode extends Enum<SecurityMode>

Defines security modes for expression evaluation and similar features.

  • RESTRICTED: Safe-by-default mode. Disables risky capabilities (type lookup, bean resolution, constructor invocation, unrestricted static access) and allows only whitelisted/custom functions and safe instance method/property access.
  • PERMISSIVE: Enables full SpEL capabilities (as provided by the configured evaluation context factory) intended only for trusted templates.
  • Enum Constant Details

    • RESTRICTED

      public static final SecurityMode RESTRICTED

      Represents the safe-by-default security mode in which potentially risky features such as type lookup, bean resolution, constructor invocations, and unrestricted static access are disabled.

      This mode enforces security and allows only whitelisted/custom functions, as well as safe instance method and property access during expression evaluation. It is recommended for scenarios involving untrusted templates.

    • PERMISSIVE

      public static final SecurityMode PERMISSIVE

      Represents the permissive security mode that enables full SpEL (Spring Expression Language) capabilities as provided by the configured evaluation context factory.

      This mode allows potentially risky features such as type lookup, bean resolution, constructor invocation, and unrestricted static access. It is intended exclusively for use with trusted templates where security concerns are not a primary issue.

  • Method Details

    • values

      public static SecurityMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SecurityMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null