Class XFrameOptionsHeaderWriter
java.lang.Object
org.springframework.security.web.header.writers.frameoptions.XFrameOptionsHeaderWriter
- All Implemented Interfaces:
- HeaderWriter
HeaderWriter implementation for the X-Frame-Options headers. When using the
 ALLOW-FROM directive the actual value is determined by a AllowFromStrategy.- Since:
- 3.2
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumThe possible values for the X-Frame-Options header.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionCreates an instance withXFrameOptionsHeaderWriter.XFrameOptionsMode.DENYXFrameOptionsHeaderWriter(AllowFromStrategy allowFromStrategy) Deprecated.ALLOW-FROM is an obsolete directive that no longer works in modern browsers.XFrameOptionsHeaderWriter(XFrameOptionsHeaderWriter.XFrameOptionsMode frameOptionsMode) Creates a new instance
- 
Method SummaryModifier and TypeMethodDescriptionvoidwriteHeaders(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Writes the X-Frame-Options header value, overwritting any previous value.
- 
Field Details- 
XFRAME_OPTIONS_HEADER- See Also:
 
 
- 
- 
Constructor Details- 
XFrameOptionsHeaderWriterpublic XFrameOptionsHeaderWriter()Creates an instance withXFrameOptionsHeaderWriter.XFrameOptionsMode.DENY
- 
XFrameOptionsHeaderWriterCreates a new instance- Parameters:
- frameOptionsMode- the- XFrameOptionsHeaderWriter.XFrameOptionsModeto use. If using- XFrameOptionsHeaderWriter.XFrameOptionsMode.ALLOW_FROM, use Content-Security-Policy with the frame-ancestors directive instead.
 
- 
XFrameOptionsHeaderWriterDeprecated.ALLOW-FROM is an obsolete directive that no longer works in modern browsers. Instead use Content-Security-Policy with the frame-ancestors directive.Creates a new instance withXFrameOptionsHeaderWriter.XFrameOptionsMode.ALLOW_FROM.- Parameters:
- allowFromStrategy- the strategy for determining what the value for ALLOW_FROM is.
- See Also:
 
 
- 
- 
Method Details- 
writeHeaderspublic void writeHeaders(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Writes the X-Frame-Options header value, overwritting any previous value.- Specified by:
- writeHeadersin interface- HeaderWriter
- Parameters:
- request- the servlet request
- response- the servlet response
 
 
-