Web context authorizers: (v6.2)
Some authorizers only apply on the web context:
1) CORS
CorsAuthorizerdefines how CORS requests are authorized via theAccess-Control-*response headers
2) CSRF
-
CsrfTokenGeneratorAuthorizergenerates a CSRF token based on a providedCsrfTokenGeneratorand adds it to the current request (pac4jCsrfTokenattribute) and saves it in thepac4jCsrfTokencookie -
CsrfAuthorizercheck sthat the web context has the appropriate CSRF token in order to protect against CSRF attacks. Using theDefaultCsrfTokenGeneratoror thecsrfTokenauthorizer, you can get the CSRF token and send it as a parameter or as a header. TheCsrfAuthorizerchecks that the request is a POST and has a CSRF token (found in a parameter or header)
3) Security headers
-
XFrameOptionsHeaderchecks that the website is not called in a Iframe -
XSSProtectionHeaderprotects against XSS attacks -
XContentTypeOptionsHeaderprevents the browser from doing MIME-type sniffing -
StrictTransportSecurityHeaderenforces the browser that it should only be communicated with using HTTPS -
CacheControlHeaderenforces the browser that it should only be communicated with using HTTPS
4) Others
-
IpRegexpAuthorizerchecks the incoming IP address -
CheckHttpMethodAuthorizerchecks that the request was performed with the appropriate HTTP method