소스 검색

Update WebFilter ordering

Issue: gh-4719
Rob Winch 7 년 전
부모
커밋
faa0bd7143

+ 9 - 3
config/src/main/java/org/springframework/security/config/web/server/SecurityWebFiltersOrder.java

@@ -23,8 +23,6 @@ package org.springframework.security.config.web.server;
 public enum SecurityWebFiltersOrder {
 	FIRST(Integer.MIN_VALUE),
 	HTTP_HEADERS_WRITER,
-	SECURITY_CONTEXT_REPOSITORY,
-	LOGIN_PAGE_GENERATING,
 	/**
 	 * Instance of AuthenticationWebFilter
 	 */
@@ -34,8 +32,16 @@ public enum SecurityWebFiltersOrder {
 	 */
 	FORM_LOGIN,
 	AUTHENTICATION,
+	/**
+	 * {@link org.springframework.security.web.server.context.ReactorContextWebFilter}
+	 */
+	REACTOR_CONTEXT,
+	LOGIN_PAGE_GENERATING,
+	/**
+	 * {@link org.springframework.security.web.server.context.SecurityContextServerWebExchangeWebFilter}
+	 */
+	SECURITY_CONTEXT_SERVER_WEB_EXCHANGE,
 	LOGOUT,
-	AUTHENTICATION_CONTEXT,
 	EXCEPTION_TRANSLATION,
 	AUTHORIZATION,
 	LAST(Integer.MAX_VALUE);

+ 2 - 2
config/src/main/java/org/springframework/security/config/web/server/ServerHttpSecurity.java

@@ -211,7 +211,7 @@ public class ServerHttpSecurity {
 		if(this.logout != null) {
 			this.logout.configure(this);
 		}
-		this.addFilterAt(new SecurityContextServerWebExchangeWebFilter(), SecurityWebFiltersOrder.AUTHENTICATION_CONTEXT);
+		this.addFilterAt(new SecurityContextServerWebExchangeWebFilter(), SecurityWebFiltersOrder.SECURITY_CONTEXT_SERVER_WEB_EXCHANGE);
 		if(this.authorizeExchangeBuilder != null) {
 			ServerAuthenticationEntryPoint serverAuthenticationEntryPoint = getServerAuthenticationEntryPoint();
 			ExceptionTranslationWebFilter exceptionTranslationWebFilter = new ExceptionTranslationWebFilter();
@@ -262,8 +262,8 @@ public class ServerHttpSecurity {
 		if(repository == null) {
 			return null;
 		}
-		return new OrderedWebFilter(result, SecurityWebFiltersOrder.SECURITY_CONTEXT_REPOSITORY.getOrder());
 		WebFilter result = new ReactorContextWebFilter(repository);
+		return new OrderedWebFilter(result, SecurityWebFiltersOrder.REACTOR_CONTEXT.getOrder());
 	}
 
 	private ServerHttpSecurity() {}