Ensure path starts with "/" in ErrorController
When mapping the ErrorController path to Spring Security it's important that it starts with "/". This change ensures that is the case even if the user has omitted the leading "/". Fixes gh-694
This commit is contained in:
@@ -40,6 +40,7 @@ import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.web.FilterChainProxy;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -79,6 +80,12 @@ public class ManagementSecurityAutoConfigurationTests {
|
||||
.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPathNormalization() throws Exception {
|
||||
String path = "admin/./error";
|
||||
assertEquals("admin/error", StringUtils.cleanPath(path));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWebConfigurationWithExtraRole() throws Exception {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
|
||||
Reference in New Issue
Block a user