Make AutoConfigureMockMvc use SecurityProperties' filter ordering

Previously, AutoConfigureMockMvc used Spring Security's default filter
ordering, ignoring the value configured by SecurityProperties that is
used at runtime. This resulted in different ordering at runtime and in
tests.

This commit updates the configuration for AutoConfigureMockMvc to
import the Spring Security filter auto-configuration, thereby ensuring
that the ordering configured via SecurityProperties is applied.

Fixes gh-21801
This commit is contained in:
Andy Wilkinson
2020-06-10 09:42:43 +01:00
parent 36faa1d42a
commit 48acaa4bd9
4 changed files with 116 additions and 2 deletions

View File

@@ -109,6 +109,7 @@ org.springframework.boot.test.autoconfigure.web.servlet.MockMvcAutoConfiguration
org.springframework.boot.test.autoconfigure.web.servlet.MockMvcWebClientAutoConfiguration,\
org.springframework.boot.test.autoconfigure.web.servlet.MockMvcWebDriverAutoConfiguration,\
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration,\
org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration,\
org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration,\
org.springframework.boot.test.autoconfigure.web.servlet.MockMvcSecurityConfiguration