Class FeaturePolicyHeaderWriter
- java.lang.Object
-
- org.springframework.security.web.header.writers.FeaturePolicyHeaderWriter
-
- All Implemented Interfaces:
HeaderWriter
public final class FeaturePolicyHeaderWriter extends java.lang.Object implements HeaderWriter
Provides support for Feature Policy.Feature 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 feature policy contains a set of security policy directives, each responsible for declaring the restrictions for a particular feature type.
- Since:
- 5.1
-
-
Constructor Summary
Constructors Constructor Description FeaturePolicyHeaderWriter(java.lang.String policyDirectives)
Create a new instance ofFeaturePolicyHeaderWriter
with supplied security policy directive(s).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setPolicyDirectives(java.lang.String policyDirectives)
Set the security policy directive(s) 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
-
FeaturePolicyHeaderWriter
public FeaturePolicyHeaderWriter(java.lang.String policyDirectives)
Create a new instance ofFeaturePolicyHeaderWriter
with supplied security policy directive(s).- Parameters:
policyDirectives
- the security policy directive(s)- Throws:
java.lang.IllegalArgumentException
- if policyDirectives isnull
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
-
setPolicyDirectives
public void setPolicyDirectives(java.lang.String policyDirectives)
Set the security policy directive(s) to be used in the response header.- Parameters:
policyDirectives
- the security policy directive(s)- Throws:
java.lang.IllegalArgumentException
- if policyDirectives isnull
or empty
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-