This commit is contained in:
Phillip Webb
2018-01-19 18:55:41 -08:00
parent d9ff51ccd3
commit dc935fba48
27 changed files with 98 additions and 74 deletions

View File

@@ -80,8 +80,8 @@ public class SampleSecureWebFluxCustomSecurityTests {
@Test
public void staticResourceShouldBeAccessible() {
this.webClient.get().uri("/css/bootstrap.min.css").accept(MediaType.APPLICATION_JSON).exchange()
.expectStatus().isOk();
this.webClient.get().uri("/css/bootstrap.min.css")
.accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk();
}
@Configuration
@@ -100,9 +100,10 @@ public class SampleSecureWebFluxCustomSecurityTests {
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
http.authorizeExchange().matchers(EndpointRequest.to("health", "info"))
.permitAll().matchers(EndpointRequest.toAnyEndpoint())
.hasRole("ACTUATOR").matchers(StaticResourceRequest.toCommonLocations()).permitAll()
.pathMatchers("/login").permitAll().anyExchange()
.authenticated().and().httpBasic();
.hasRole("ACTUATOR")
.matchers(StaticResourceRequest.toCommonLocations()).permitAll()
.pathMatchers("/login").permitAll().anyExchange().authenticated()
.and().httpBasic();
return http.build();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 the original author or authors.
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.