Remove formLogin() and httpBasic() from defaults
This commit is contained in:
parent
5fae710d69
commit
211e8eae90
|
@ -67,8 +67,6 @@ public class ServerHttpSecurityConfiguration implements WebFluxConfigurer {
|
||||||
return http()
|
return http()
|
||||||
.authenticationManager(authenticationManager())
|
.authenticationManager(authenticationManager())
|
||||||
.headers().and()
|
.headers().and()
|
||||||
.httpBasic().and()
|
|
||||||
.formLogin().and()
|
|
||||||
.logout().and();
|
.logout().and();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,11 @@ public class WebFluxSecurityConfiguration {
|
||||||
ServerHttpSecurity http = context.getBean(ServerHttpSecurity.class);
|
ServerHttpSecurity http = context.getBean(ServerHttpSecurity.class);
|
||||||
http
|
http
|
||||||
.authorizeExchange()
|
.authorizeExchange()
|
||||||
.anyExchange().authenticated();
|
.anyExchange().authenticated()
|
||||||
|
.and()
|
||||||
|
.httpBasic().and()
|
||||||
|
.formLogin().and()
|
||||||
|
.build();
|
||||||
return Arrays.asList(http.build());
|
return Arrays.asList(http.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class LogoutBuilderTests {
|
||||||
.authorizeExchange()
|
.authorizeExchange()
|
||||||
.anyExchange().authenticated()
|
.anyExchange().authenticated()
|
||||||
.and()
|
.and()
|
||||||
|
.formLogin().and()
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
WebTestClient webTestClient = WebTestClientBuilder
|
WebTestClient webTestClient = WebTestClientBuilder
|
||||||
|
@ -82,6 +83,7 @@ public class LogoutBuilderTests {
|
||||||
.authorizeExchange()
|
.authorizeExchange()
|
||||||
.anyExchange().authenticated()
|
.anyExchange().authenticated()
|
||||||
.and()
|
.and()
|
||||||
|
.formLogin().and()
|
||||||
.logout()
|
.logout()
|
||||||
.logoutUrl("/custom-logout")
|
.logoutUrl("/custom-logout")
|
||||||
.and()
|
.and()
|
||||||
|
|
|
@ -36,10 +36,12 @@ public class SecurityConfig {
|
||||||
@Bean
|
@Bean
|
||||||
SecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http) throws Exception {
|
SecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http) throws Exception {
|
||||||
return http
|
return http
|
||||||
// we rely on method security
|
// Demonstrate that method security works
|
||||||
|
// Best practice to use both for defense in depth
|
||||||
.authorizeExchange()
|
.authorizeExchange()
|
||||||
.anyExchange().permitAll()
|
.anyExchange().permitAll()
|
||||||
.and()
|
.and()
|
||||||
|
.httpBasic().and()
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue