|
|
|
|
@ -31,7 +31,6 @@ import org.springframework.mock.web.MockServletContext;
@@ -31,7 +31,6 @@ import org.springframework.mock.web.MockServletContext;
|
|
|
|
|
import org.springframework.security.authorization.AuthorizationManager; |
|
|
|
|
import org.springframework.security.config.test.SpringTestContext; |
|
|
|
|
import org.springframework.security.config.test.SpringTestContextExtension; |
|
|
|
|
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource; |
|
|
|
|
import org.springframework.test.web.servlet.MockMvc; |
|
|
|
|
import org.springframework.test.web.servlet.request.RequestPostProcessor; |
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable; |
|
|
|
|
@ -90,8 +89,6 @@ public class InterceptUrlConfigTests {
@@ -90,8 +89,6 @@ public class InterceptUrlConfigTests {
|
|
|
|
|
this.mvc.perform(get("/path").with(userCredentials())) |
|
|
|
|
.andExpect(status().isOk()); |
|
|
|
|
// @formatter:on
|
|
|
|
|
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class)) |
|
|
|
|
.isEmpty(); |
|
|
|
|
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -125,8 +122,6 @@ public class InterceptUrlConfigTests {
@@ -125,8 +122,6 @@ public class InterceptUrlConfigTests {
|
|
|
|
|
this.mvc.perform(patch("/path").with(adminCredentials())) |
|
|
|
|
.andExpect(status().isOk()); |
|
|
|
|
// @formatter:on
|
|
|
|
|
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class)) |
|
|
|
|
.isEmpty(); |
|
|
|
|
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -150,8 +145,6 @@ public class InterceptUrlConfigTests {
@@ -150,8 +145,6 @@ public class InterceptUrlConfigTests {
|
|
|
|
|
this.mvc.perform(get("/path").with(adminCredentials())) |
|
|
|
|
.andExpect(status().isForbidden()); |
|
|
|
|
// @formatter:on
|
|
|
|
|
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class)) |
|
|
|
|
.isEmpty(); |
|
|
|
|
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -186,8 +179,6 @@ public class InterceptUrlConfigTests {
@@ -186,8 +179,6 @@ public class InterceptUrlConfigTests {
|
|
|
|
|
this.mvc.perform(get("/path").with(userCredentials())) |
|
|
|
|
.andExpect(status().isForbidden()); |
|
|
|
|
// @formatter:on
|
|
|
|
|
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class)) |
|
|
|
|
.isEmpty(); |
|
|
|
|
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -222,8 +213,6 @@ public class InterceptUrlConfigTests {
@@ -222,8 +213,6 @@ public class InterceptUrlConfigTests {
|
|
|
|
|
this.mvc.perform(get("/PATH/user/path").with(userCredentials())) |
|
|
|
|
.andExpect(status().isForbidden()); |
|
|
|
|
// @formatter:on
|
|
|
|
|
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class)) |
|
|
|
|
.isEmpty(); |
|
|
|
|
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -254,8 +243,6 @@ public class InterceptUrlConfigTests {
@@ -254,8 +243,6 @@ public class InterceptUrlConfigTests {
|
|
|
|
|
this.mvc.perform(get("/path/2/path").with(userCredentials())) |
|
|
|
|
.andExpect(status().isForbidden()); |
|
|
|
|
// @formatter:on
|
|
|
|
|
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class)) |
|
|
|
|
.isEmpty(); |
|
|
|
|
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -273,8 +260,6 @@ public class InterceptUrlConfigTests {
@@ -273,8 +260,6 @@ public class InterceptUrlConfigTests {
|
|
|
|
|
this.mvc.perform(get("/path")).andExpect(status().isUnauthorized()); |
|
|
|
|
this.mvc.perform(get("/path.html")).andExpect(status().isUnauthorized()); |
|
|
|
|
this.mvc.perform(get("/path/")).andExpect(status().isUnauthorized()); |
|
|
|
|
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class)) |
|
|
|
|
.isEmpty(); |
|
|
|
|
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -303,8 +288,6 @@ public class InterceptUrlConfigTests {
@@ -303,8 +288,6 @@ public class InterceptUrlConfigTests {
|
|
|
|
|
this.mvc.perform(get("/PATH/user/path").with(userCredentials())) |
|
|
|
|
.andExpect(status().isForbidden()); |
|
|
|
|
// @formatter:on
|
|
|
|
|
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class)) |
|
|
|
|
.isEmpty(); |
|
|
|
|
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -339,8 +322,6 @@ public class InterceptUrlConfigTests {
@@ -339,8 +322,6 @@ public class InterceptUrlConfigTests {
|
|
|
|
|
this.mvc.perform(get("/spring/path/").servletPath("/spring")) |
|
|
|
|
.andExpect(status().isUnauthorized()); |
|
|
|
|
// @formatter:on
|
|
|
|
|
assertThat(this.spring.getContext().getBeanNamesForType(FilterInvocationSecurityMetadataSource.class)) |
|
|
|
|
.isEmpty(); |
|
|
|
|
assertThat(this.spring.getContext().getBean(AuthorizationManager.class)).isNotNull(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|