org.apache.struts2.interceptor.csp

## Interface CspSettings

- All Known Implementing Classes:
    DefaultCspSettings

      public interface CspSettings

  CspSettings interface used by the `CspInterceptor` to add the CSP header to the response. The default implementation can be found in `DefaultCspSettings`.
  See Also:
    `DefaultCspSettings`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `BASE_URI`
    `static String` | `CSP_ENFORCE_HEADER`
    `static String` | `CSP_REPORT_HEADER`
    `static String` | `CSP_REPORT_TYPE`
    `static String` | `HTTP`
    `static String` | `HTTPS`
    `static int` | `NONCE_RANDOM_LENGTH`
    `static String` | `NONE`
    `static String` | `OBJECT_SRC`
    `static String` | `REPORT_URI`
    `static String` | `SCRIPT_SRC`
    `static String` | `STRICT_DYNAMIC`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCspHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)`
    `void` | `addCspHeaders(javax.servlet.http.HttpServletResponse response)` Deprecated. use `addCspHeaders(HttpServletRequest, HttpServletResponse)` instead
    `void` | `setEnforcingMode(boolean value)` Sets CSP headers in enforcing mode when true, and report-only when false
    `void` | `setReportUri(String uri)` Sets the uri where csp violation reports will be sent

- - ### Field Detail

    - #### NONCE_RANDOM_LENGTH

          static final int NONCE_RANDOM_LENGTH

      See Also:
        Constant Field Values

    - #### CSP_ENFORCE_HEADER

          static final String CSP_ENFORCE_HEADER

      See Also:
        Constant Field Values

    - #### CSP_REPORT_HEADER

          static final String CSP_REPORT_HEADER

      See Also:
        Constant Field Values

    - #### OBJECT_SRC

          static final String OBJECT_SRC

      See Also:
        Constant Field Values

    - #### SCRIPT_SRC

          static final String SCRIPT_SRC

      See Also:
        Constant Field Values

    - #### BASE_URI

          static final String BASE_URI

      See Also:
        Constant Field Values

    - #### REPORT_URI

          static final String REPORT_URI

      See Also:
        Constant Field Values

    - #### NONE

          static final String NONE

      See Also:
        Constant Field Values

    - #### STRICT_DYNAMIC

          static final String STRICT_DYNAMIC

      See Also:
        Constant Field Values

    - #### HTTP

          static final String HTTP

      See Also:
        Constant Field Values

    - #### HTTPS

          static final String HTTPS

      See Also:
        Constant Field Values

    - #### CSP_REPORT_TYPE

          static final String CSP_REPORT_TYPE

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### addCspHeaders

          @Deprecated
          void addCspHeaders(javax.servlet.http.HttpServletResponse response)

      Deprecated. use `addCspHeaders(HttpServletRequest, HttpServletResponse)` instead

    - #### addCspHeaders

          void addCspHeaders(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)

    - #### setReportUri

          void setReportUri(String uri)

      Sets the uri where csp violation reports will be sent

    - #### setEnforcingMode

          void setEnforcingMode(boolean value)

      Sets CSP headers in enforcing mode when true, and report-only when false

Copyright © 2000–2023 Apache Software Foundation. All rights reserved.