Class PermissionsPolicyHeaderWriter
java.lang.Object
org.springframework.security.web.header.writers.PermissionsPolicyHeaderWriter
- All Implemented Interfaces:
HeaderWriter
Provides support for
Permisisons Policy.
Permissions Policy allows web developers to selectively enable, disable, and modify the behavior of certain APIs and web features in the browser.
A declaration of a permissions policy contains a set of security policies, each responsible for declaring the restrictions for a particular feature type.
- Since:
- 5.5
-
Constructor Summary
ConstructorDescriptionCreate a new instance ofPermissionsPolicyHeaderWriter
.PermissionsPolicyHeaderWriter
(String policy) Create a new instance ofPermissionsPolicyHeaderWriter
with supplied security policy. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Sets the policy to be used in the response header.toString()
void
writeHeaders
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Create aHeader
instance.
-
Constructor Details
-
PermissionsPolicyHeaderWriter
public PermissionsPolicyHeaderWriter()Create a new instance ofPermissionsPolicyHeaderWriter
. -
PermissionsPolicyHeaderWriter
Create a new instance ofPermissionsPolicyHeaderWriter
with supplied security policy.- Parameters:
policy
- the security policy- Throws:
IllegalArgumentException
- if policy isnull
or empty
-
-
Method Details
-
setPolicy
Sets the policy to be used in the response header.- Parameters:
policy
- a permissions 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
-
toString
-