|
@@ -192,9 +192,11 @@ The {security-api-url}org/springframework/security/web/context/SecurityContextPe
|
|
|
|
|
|
image::{figures}/securitycontextpersistencefilter.png[]
|
|
image::{figures}/securitycontextpersistencefilter.png[]
|
|
|
|
|
|
-<1> Before running the rest of the application, `SecurityContextPersistenceFilter` loads the `SecurityContext` from the `SecurityContextRepository` and sets it on the `SecurityContextHolder`.
|
|
|
|
-<2> Next, the application is ran.
|
|
|
|
-<3> Finally, if the `SecurityContext` has changed, we save the `SecurityContext` using the `SecurityContextPersistenceRepository`.
|
|
|
|
|
|
+image:{icondir}/number_1.png[] Before running the rest of the application, `SecurityContextPersistenceFilter` loads the `SecurityContext` from the `SecurityContextRepository` and sets it on the `SecurityContextHolder`.
|
|
|
|
+
|
|
|
|
+image:{icondir}/number_2.png[] Next, the application is ran.
|
|
|
|
+
|
|
|
|
+image:{icondir}/number_3.png[] Finally, if the `SecurityContext` has changed, we save the `SecurityContext` using the `SecurityContextPersistenceRepository`.
|
|
This means that when using `SecurityContextPersistenceFilter`, just setting the `SecurityContextHolder` will ensure that the `SecurityContext` is persisted using `SecurityContextRepository`.
|
|
This means that when using `SecurityContextPersistenceFilter`, just setting the `SecurityContextHolder` will ensure that the `SecurityContext` is persisted using `SecurityContextRepository`.
|
|
|
|
|
|
In some cases a response is committed and written to the client before the `SecurityContextPersisteneFilter` method completes.
|
|
In some cases a response is committed and written to the client before the `SecurityContextPersisteneFilter` method completes.
|
|
@@ -211,11 +213,12 @@ The {security-api-url}org/springframework/security/web/context/SecurityContextHo
|
|
|
|
|
|
image::{figures}/securitycontextholderfilter.png[]
|
|
image::{figures}/securitycontextholderfilter.png[]
|
|
|
|
|
|
-<1> Before running the rest of the application, `SecurityContextHolderFilter` loads the `SecurityContext` from the `SecurityContextRepository` and sets it on the `SecurityContextHolder`.
|
|
|
|
-<2> Next, the application is ran.
|
|
|
|
|
|
+image:{icondir}/number_1.png[] Before running the rest of the application, `SecurityContextHolderFilter` loads the `SecurityContext` from the `SecurityContextRepository` and sets it on the `SecurityContextHolder`.
|
|
|
|
+
|
|
|
|
+image:{icondir}/number_2.png[] Next, the application is ran.
|
|
|
|
|
|
Unlike, xref:servlet/authentication/persistence.adoc#securitycontextpersistencefilter[`SecurityContextPersistenceFilter`], `SecurityContextHolderFilter` only loads the `SecurityContext` it does not save the `SecurityContext`.
|
|
Unlike, xref:servlet/authentication/persistence.adoc#securitycontextpersistencefilter[`SecurityContextPersistenceFilter`], `SecurityContextHolderFilter` only loads the `SecurityContext` it does not save the `SecurityContext`.
|
|
This means that when using `SecurityContextHolderFilter`, it is required that the `SecurityContext` is explicitly saved.
|
|
This means that when using `SecurityContextHolderFilter`, it is required that the `SecurityContext` is explicitly saved.
|
|
|
|
|
|
|
|
|
|
-include::partial$servlet/architecture/security-context-explicit.adoc[]
|
|
|
|
|
|
+include::partial$servlet/architecture/security-context-explicit.adoc[]
|