WebFluxSecurityConfiguration defaults HTTP Basic

Fixes gh-4346
This commit is contained in:
Rob Winch 2017-05-19 21:50:06 -05:00
parent 1cec497a50
commit 247635ed92
4 changed files with 7 additions and 4 deletions

View File

@ -62,6 +62,7 @@ public class WebFluxSecurityConfiguration implements WebFluxConfigurer {
@Bean
public HttpSecurity httpSecurity() {
HttpSecurity http = http();
http.httpBasic();
http.authenticationManager(authenticationManager());
http.securityContextRepository(new WebSessionSecurityContextRepository());
return http;

View File

@ -96,6 +96,12 @@ public class HttpSecurity {
.flatMap( r -> Optional.of(new SecurityContextRepositoryWebFilter(r)));
}
public class HttpBasicSpec extends HttpBasicBuilder {
public HttpSecurity disable() {
httpBasic = null;
return HttpSecurity.this;
}
}
private HttpSecurity() {}
}

View File

@ -36,8 +36,6 @@ public class SecurityConfig {
@Bean
WebFilter springSecurityFilterChain(HttpSecurity http) throws Exception {
http.httpBasic();
http.authorizeExchange()
.antMatchers("/admin/**").hasRole("ADMIN")
.antMatchers("/users/{user}/**").access(this::currentUserMatchesPath)

View File

@ -36,8 +36,6 @@ public class SecurityConfig {
@Bean
WebFilter springSecurityFilterChain(HttpSecurity http) throws Exception {
http.httpBasic();
http.authorizeExchange()
.antMatchers("/admin/**").hasRole("ADMIN")
.antMatchers("/users/{user}/**").access(this::currentUserMatchesPath)