Class PermissionsPolicyHeaderWriter
- java.lang.Object
-
- org.springframework.security.web.header.writers.PermissionsPolicyHeaderWriter
-
- All Implemented Interfaces:
HeaderWriter
public final class PermissionsPolicyHeaderWriter extends java.lang.Object implements 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
Constructors Constructor Description PermissionsPolicyHeaderWriter()
Create a new instance ofPermissionsPolicyHeaderWriter
.PermissionsPolicyHeaderWriter(java.lang.String policy)
Create a new instance ofPermissionsPolicyHeaderWriter
with supplied security policy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setPolicy(java.lang.String policy)
Sets the policy to be used in the response header.java.lang.String
toString()
void
writeHeaders(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Create aHeader
instance.
-
-
-
Constructor Detail
-
PermissionsPolicyHeaderWriter
public PermissionsPolicyHeaderWriter()
Create a new instance ofPermissionsPolicyHeaderWriter
.
-
PermissionsPolicyHeaderWriter
public PermissionsPolicyHeaderWriter(java.lang.String policy)
Create a new instance ofPermissionsPolicyHeaderWriter
with supplied security policy.- Parameters:
policy
- the security policy- Throws:
java.lang.IllegalArgumentException
- if policy isnull
or empty
-
-
Method Detail
-
setPolicy
public void setPolicy(java.lang.String policy)
Sets the policy to be used in the response header.- Parameters:
policy
- a permissions policy- Throws:
java.lang.IllegalArgumentException
- if policy is null
-
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
-
-