Class ClearSiteDataHeaderWriter
- java.lang.Object
-
- org.springframework.security.web.header.writers.ClearSiteDataHeaderWriter
-
- All Implemented Interfaces:
HeaderWriter
public final class ClearSiteDataHeaderWriter extends java.lang.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ClearSiteDataHeaderWriter.Directive
Represents the directive values expected by theClearSiteDataHeaderWriter
.
-
Constructor Summary
Constructors Constructor Description ClearSiteDataHeaderWriter(ClearSiteDataHeaderWriter.Directive... directives)
Creates a new instance ofClearSiteDataHeaderWriter
with given sources.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
toString()
void
writeHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Create aHeader
instance.
-
-
-
Constructor Detail
-
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:
java.lang.IllegalArgumentException
- if sources is null or empty.
-
-
Method Detail
-
writeHeaders
public void writeHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Description copied from interface:HeaderWriter
Create aHeader
instance.- Specified by:
writeHeaders
in interfaceHeaderWriter
- Parameters:
request
- the requestresponse
- the response
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-