WebFluxSecurityConfiguration defaults HTTP Basic
Fixes gh-4346
This commit is contained in:
parent
1cec497a50
commit
247635ed92
|
@ -62,6 +62,7 @@ public class WebFluxSecurityConfiguration implements WebFluxConfigurer {
|
||||||
@Bean
|
@Bean
|
||||||
public HttpSecurity httpSecurity() {
|
public HttpSecurity httpSecurity() {
|
||||||
HttpSecurity http = http();
|
HttpSecurity http = http();
|
||||||
|
http.httpBasic();
|
||||||
http.authenticationManager(authenticationManager());
|
http.authenticationManager(authenticationManager());
|
||||||
http.securityContextRepository(new WebSessionSecurityContextRepository());
|
http.securityContextRepository(new WebSessionSecurityContextRepository());
|
||||||
return http;
|
return http;
|
||||||
|
|
|
@ -96,6 +96,12 @@ public class HttpSecurity {
|
||||||
.flatMap( r -> Optional.of(new SecurityContextRepositoryWebFilter(r)));
|
.flatMap( r -> Optional.of(new SecurityContextRepositoryWebFilter(r)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class HttpBasicSpec extends HttpBasicBuilder {
|
||||||
|
public HttpSecurity disable() {
|
||||||
|
httpBasic = null;
|
||||||
|
return HttpSecurity.this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private HttpSecurity() {}
|
private HttpSecurity() {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,8 +36,6 @@ public class SecurityConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
WebFilter springSecurityFilterChain(HttpSecurity http) throws Exception {
|
WebFilter springSecurityFilterChain(HttpSecurity http) throws Exception {
|
||||||
http.httpBasic();
|
|
||||||
|
|
||||||
http.authorizeExchange()
|
http.authorizeExchange()
|
||||||
.antMatchers("/admin/**").hasRole("ADMIN")
|
.antMatchers("/admin/**").hasRole("ADMIN")
|
||||||
.antMatchers("/users/{user}/**").access(this::currentUserMatchesPath)
|
.antMatchers("/users/{user}/**").access(this::currentUserMatchesPath)
|
||||||
|
|
|
@ -36,8 +36,6 @@ public class SecurityConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
WebFilter springSecurityFilterChain(HttpSecurity http) throws Exception {
|
WebFilter springSecurityFilterChain(HttpSecurity http) throws Exception {
|
||||||
http.httpBasic();
|
|
||||||
|
|
||||||
http.authorizeExchange()
|
http.authorizeExchange()
|
||||||
.antMatchers("/admin/**").hasRole("ADMIN")
|
.antMatchers("/admin/**").hasRole("ADMIN")
|
||||||
.antMatchers("/users/{user}/**").access(this::currentUserMatchesPath)
|
.antMatchers("/users/{user}/**").access(this::currentUserMatchesPath)
|
||||||
|
|
Loading…
Reference in New Issue