From aaf78330b1629fd1a3b1a1b3892592847b301f52 Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Fri, 15 Apr 2022 13:55:54 -0500 Subject: [PATCH] ForceEagerSessionCreationFilter Closes gh-11109 --- .../annotation/web/HttpSecurityBuilder.java | 2 + .../web/builders/FilterOrderRegistration.java | 2 + .../SecurityContextConfigurer.java | 2 + .../SessionManagementConfigurer.java | 4 ++ .../config/http/HttpConfigurationBuilder.java | 14 +++++ .../security/config/http/SecurityFilters.java | 2 + .../security/config/spring-security-5.7.rnc | 2 +- .../security/config/spring-security-5.7.xsd | 59 ++++++++++--------- .../FilterOrderRegistrationTests.java | 2 +- .../ROOT/pages/servlet/architecture.adoc | 1 + .../authentication/session-management.adoc | 29 +++++++++ .../servlet/configuration/xml-namespace.adoc | 4 ++ .../ForceEagerSessionCreationFilter.java | 48 +++++++++++++++ .../ForceEagerSessionCreationFilterTests.java | 41 +++++++++++++ 14 files changed, 181 insertions(+), 31 deletions(-) create mode 100644 web/src/main/java/org/springframework/security/web/session/ForceEagerSessionCreationFilter.java create mode 100644 web/src/test/java/org/springframework/security/web/session/ForceEagerSessionCreationFilterTests.java diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/HttpSecurityBuilder.java b/config/src/main/java/org/springframework/security/config/annotation/web/HttpSecurityBuilder.java index 83dcdfb6c3..14b3014588 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/HttpSecurityBuilder.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/HttpSecurityBuilder.java @@ -43,6 +43,7 @@ import org.springframework.security.web.savedrequest.RequestCacheAwareFilter; import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter; import org.springframework.security.web.session.ConcurrentSessionFilter; import org.springframework.security.web.session.DisableEncodeUrlFilter; +import org.springframework.security.web.session.ForceEagerSessionCreationFilter; import org.springframework.security.web.session.SessionManagementFilter; /** @@ -125,6 +126,7 @@ public interface HttpSecurityBuilder> * The ordering of the Filters is: * *