Enum Class FetchDirective

java.lang.Object
java.lang.Enum<FetchDirective>
jenkins.security.csp.FetchDirective
All Implemented Interfaces:
Serializable, Comparable<FetchDirective>, Constable

@Restricted(org.kohsuke.accmod.restrictions.Beta.class) public enum FetchDirective extends Enum<FetchDirective>
The fetch directives and their inheritance rules (in getFallback()).
Since:
TODO
See Also:
  • Enum Constant Details

  • Method Details

    • values

      public static FetchDirective[] 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 FetchDirective 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
    • toKey

      public String toKey()
    • fromKey

      public static FetchDirective fromKey(String s)
      Returns the FetchDirective corresponding to the specified key. For example, the parameter default-src will return DEFAULT_SRC.
      Parameters:
      s - the key for the directive
      Returns:
      the FetchDirective corresponding to the key
    • isFetchDirective

      public static boolean isFetchDirective(String key)
      Returns true if and only if the specified key is a FetchDirective. Returns true for script-src, false for sandbox.
    • toFetchDirective

      public static Optional<FetchDirective> toFetchDirective(String key)
      Similar to fromKey(String), this returns the corresponding FetchDirective wrapped in Optional. If the specified key does not correspond to a fetch directive, instead leaves the Optional empty.
      Parameters:
      key - the key for the directive
      Returns:
      an Optional containing the corresponding FetchDirective, or left empty if there is none.
    • getFallback

      public FetchDirective getFallback()
      Which element is used as fallback if one is undefined. For *-src-elem and *-src-attr this is the corresponding *-src, for frame-src and worker-src this is child-src, for everything else, except default-src, it's default-src.
      Returns:
      The fallback directive if this one is unspecified, or null if there is no fallback.
      See Also: