Add PathRequest to reactive security for parity

This commit is contained in:
Madhura Bhave
2018-01-29 18:19:04 -08:00
parent e80c22cbf8
commit 134628a62d
6 changed files with 114 additions and 22 deletions

View File

@@ -23,6 +23,7 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.autoconfigure.security.reactive.EndpointRequest;
import org.springframework.boot.autoconfigure.security.reactive.PathRequest;
import org.springframework.boot.autoconfigure.security.reactive.StaticResourceRequest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
@@ -101,7 +102,7 @@ public class SampleSecureWebFluxCustomSecurityTests {
http.authorizeExchange().matchers(EndpointRequest.to("health", "info"))
.permitAll().matchers(EndpointRequest.toAnyEndpoint())
.hasRole("ACTUATOR")
.matchers(StaticResourceRequest.toCommonLocations()).permitAll()
.matchers(PathRequest.toStaticResources().atCommonLocations()).permitAll()
.pathMatchers("/login").permitAll().anyExchange().authenticated()
.and().httpBasic();
return http.build();