Class ClearSiteDataHeaderWriter

java.lang.Object
org.springframework.security.web.header.writers.ClearSiteDataHeaderWriter
All Implemented Interfaces:
HeaderWriter

public final class ClearSiteDataHeaderWriter extends Object implements HeaderWriter
Provides support for Clear Site Data.

Developers may instruct a user agent to clear various types of relevant data by delivering a Clear-Site-Data HTTP response header in response to a request.

Due to Incomplete Clearing section the header is only applied if the request is secure.

Since:
5.2
  • Constructor Details

    • ClearSiteDataHeaderWriter

      public ClearSiteDataHeaderWriter(ClearSiteDataHeaderWriter.Directive... directives)

      Creates a new instance of ClearSiteDataHeaderWriter with given sources. The constructor also initializes requestMatcher with a new instance of SecureRequestMatcher to ensure that header is only applied if and when the request is secure as per the Incomplete Clearing section.

      Parameters:
      directives - (i.e. "cache", "cookies", "storage", "executionContexts" or "*")
      Throws:
      IllegalArgumentException - if sources is null or empty.
  • Method Details

    • writeHeaders

      public void writeHeaders(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Description copied from interface: HeaderWriter
      Create a Header instance.
      Specified by:
      writeHeaders in interface HeaderWriter
      Parameters:
      request - the request
      response - the response
    • toString

      public String toString()
      Overrides:
      toString in class Object