Enum Class CspMode

java.lang.Object
java.lang.Enum<CspMode>
com.vaadin.flow.server.CspMode
All Implemented Interfaces:
Serializable, Comparable<CspMode>, Constable

public enum CspMode extends Enum<CspMode>
Modes for running the application under a strict Content Security Policy, i.e. a nonce-based script-src policy without 'unsafe-inline' and 'unsafe-eval'.

The mode is configured with the InitParameters.CSP configuration parameter and read with DeploymentConfiguration.getCspMode().

Note: so far only the setting exists. Vaadin does not yet log or enforce anything in the WARN and STRICT modes, and in particular sends no Content Security Policy header. All modes currently behave like OFF.

Since:
25.4
  • Enum Constant Details

    • OFF

      public static final CspMode OFF
      The default mode. The application behaves as if no strict Content Security Policy is in use.
    • WARN

      public static final CspMode WARN
      The application runs unchanged, but every call that would not work under a strict Content Security Policy is logged. Not implemented yet.
    • STRICT

      public static final CspMode STRICT
      Vaadin sends a nonce-based Content Security Policy, and APIs that need eval throw. Not implemented yet.
  • Method Details

    • values

      public static CspMode[] 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 CspMode 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