Class ClearSiteDataHeaderWriter
java.lang.Object
org.springframework.security.web.header.writers.ClearSiteDataHeaderWriter
- All Implemented Interfaces:
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
Modifier and TypeClassDescriptionstatic enum
Represents the directive values expected by theClearSiteDataHeaderWriter
. -
Constructor Summary
ConstructorDescriptionClearSiteDataHeaderWriter
(ClearSiteDataHeaderWriter.Directive... directives) Creates a new instance ofClearSiteDataHeaderWriter
with given sources. -
Method Summary
Modifier and TypeMethodDescriptiontoString()
void
writeHeaders
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Create aHeader
instance.
-
Constructor Details
-
ClearSiteDataHeaderWriter
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 aHeader
instance.- Specified by:
writeHeaders
in interfaceHeaderWriter
- Parameters:
request
- the requestresponse
- the response
-
toString
-