Update WebFilter ordering

Issue: gh-4719
This commit is contained in:
Rob Winch 2017-10-26 22:47:42 -05:00
parent 4777a869bc
commit faa0bd7143
2 changed files with 11 additions and 5 deletions

View File

@ -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);

View File

@ -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() {}