Spring Security Reference
5.3.0.BUILD-SNAPSHOT Spring Security xvi
III. Reactive Applications ......................................................................................................... 323
21. WebFlux Security ..................................................................................................... 324
21.1. Minimal WebFlux Security Configuration .......................................................... 324
21.2. Explicit WebFlux Security Configuration ........................................................... 324
22. Protection Against Exploits ........................................................................................ 326
22.1. Cross Site Request Forgery (CSRF) for WebFlux Environments ........................ 326
Using Spring Security CSRF Protection ........................................................... 326
Use proper HTTP verbs .......................................................................... 326
Configure CSRF Protection ..................................................................... 326
Include the CSRF Token ......................................................................... 327
CSRF Considerations ..................................................................................... 329
Logging In .............................................................................................. 329
Logging Out ........................................................................................... 329
CSRF and Session Timeouts .................................................................. 330
Multipart (file upload) .............................................................................. 330
HiddenHttpMethodFilter ........................................................................... 330
22.2. Security HTTP Response Headers .................................................................. 330
Default Security Headers ................................................................................ 331
Cache Control ................................................................................................ 331
Content Type Options ..................................................................................... 332
HTTP Strict Transport Security (HSTS) ............................................................ 332
X-Frame-Options ............................................................................................ 332
X-XSS-Protection ............................................................................................ 333
Content Security Policy (CSP) ......................................................................... 333
Referrer Policy ............................................................................................... 334
Feature Policy ................................................................................................ 334
Clear Site Data .............................................................................................. 335
22.3. HTTP ............................................................................................................ 335
Redirect to HTTPS ......................................................................................... 335
Strict Transport Security ................................................................................. 336
Proxy Server Configuration ............................................................................. 336
23. OAuth2 WebFlux ...................................................................................................... 337
23.1. OAuth 2.0 Login ............................................................................................ 337
Spring Boot 2.0 Sample .................................................................................. 337
Initial setup ............................................................................................ 337
Setting the redirect URI .......................................................................... 337
Configure application.yml ................................................................ 338
Boot up the application ........................................................................... 338
Using OpenID Provider Configuration .............................................................. 338
Explicit OAuth2 Login Configuration ................................................................. 339
23.2. OAuth2 Client ................................................................................................ 340
23.3. OAuth 2.0 Resource Server ............................................................................ 340
Dependencies ................................................................................................ 340
Minimal Configuration for JWTs ....................................................................... 340
Specifying the Authorization Server ......................................................... 341
Startup Expectations ............................................................................... 341
Runtime Expectations ............................................................................. 341
Specifying the Authorization Server JWK Set Uri Directly .......................... 342
Overriding or Replacing Boot Auto Configuration ...................................... 342
Configuring Trusted Algorithms ....................................................................... 344