Class ReferrerPolicyHeaderWriter
java.lang.Object
org.springframework.security.web.header.writers.ReferrerPolicyHeaderWriter
- All Implemented Interfaces:
HeaderWriter
Provides support for Referrer Policy.
The list of policies defined can be found at Referrer Policies.
This implementation of HeaderWriter
writes the following header:
- Referrer-Policy
By default, the Referrer-Policy header is not included in the response. Policy
no-referrer is used by default if no ReferrerPolicyHeaderWriter.ReferrerPolicy
is set.
- Since:
- 4.2
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionCreates a new instance.Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Sets the policy to be used in the response header.void
writeHeaders
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Create aHeader
instance.
-
Constructor Details
-
ReferrerPolicyHeaderWriter
public ReferrerPolicyHeaderWriter()Creates a new instance. Default value: no-referrer. -
ReferrerPolicyHeaderWriter
Creates a new instance.- Parameters:
policy
- a referrer policy- Throws:
IllegalArgumentException
- if policy is null
-
-
Method Details
-
setPolicy
Sets the policy to be used in the response header.- Parameters:
policy
- a referrer policy- Throws:
IllegalArgumentException
- if policy is null
-
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- See Also:
-