|
@@ -41,6 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
|
|
/**
|
|
|
* @author Rob Winch
|
|
|
+ * @author M.S. Dousti
|
|
|
*
|
|
|
*/
|
|
|
public class UrlAuthorizationConfigurerTests {
|
|
@@ -203,6 +204,24 @@ public class UrlAuthorizationConfigurerTests {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void anonymousUrlAuthorization() {
|
|
|
+ loadConfig(AnonymousUrlAuthorizationConfig.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ @EnableWebSecurity
|
|
|
+ @Configuration
|
|
|
+ static class AnonymousUrlAuthorizationConfig extends WebSecurityConfigurerAdapter {
|
|
|
+ @Override
|
|
|
+ public void configure(HttpSecurity http) throws Exception {
|
|
|
+ // @formatter:off
|
|
|
+ http
|
|
|
+ .apply(new UrlAuthorizationConfigurer<>(null)).getRegistry()
|
|
|
+ .anyRequest().anonymous();
|
|
|
+ // @formatter:on
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public void loadConfig(Class<?>... configs) {
|
|
|
this.context = new AnnotationConfigWebApplicationContext();
|
|
|
this.context.register(configs);
|