mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-28 14:52:24 +00:00
HttpSecurityConfiguration applies all defaults
HttpSecurity headers is off by default and relies on HttpSecurityConfiguration to enable it. This is more consistent with the other operators
This commit is contained in:
parent
b5edb58050
commit
3d745e63f6
@ -67,12 +67,12 @@ public class HttpSecurityConfiguration implements WebFluxConfigurer {
|
|||||||
@Bean(HTTPSECURITY_BEAN_NAME)
|
@Bean(HTTPSECURITY_BEAN_NAME)
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
public HttpSecurity httpSecurity() {
|
public HttpSecurity httpSecurity() {
|
||||||
HttpSecurity http = http();
|
return http()
|
||||||
http.httpBasic();
|
.authenticationManager(authenticationManager())
|
||||||
http.formLogin();
|
.securityContextRepository(new WebSessionSecurityContextRepository())
|
||||||
http.authenticationManager(authenticationManager());
|
.headers().and()
|
||||||
http.securityContextRepository(new WebSessionSecurityContextRepository());
|
.httpBasic().and()
|
||||||
return http;
|
.formLogin().and();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ReactiveAuthenticationManager authenticationManager() {
|
private ReactiveAuthenticationManager authenticationManager() {
|
||||||
|
@ -79,7 +79,7 @@ public class HttpSecurity {
|
|||||||
|
|
||||||
private AuthorizeExchangeBuilder authorizeExchangeBuilder;
|
private AuthorizeExchangeBuilder authorizeExchangeBuilder;
|
||||||
|
|
||||||
private HeaderBuilder headers = new HeaderBuilder();
|
private HeaderBuilder headers;
|
||||||
private HttpBasicBuilder httpBasic;
|
private HttpBasicBuilder httpBasic;
|
||||||
private FormLoginBuilder formLogin;
|
private FormLoginBuilder formLogin;
|
||||||
|
|
||||||
@ -132,6 +132,9 @@ public class HttpSecurity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public HeaderBuilder headers() {
|
public HeaderBuilder headers() {
|
||||||
|
if(this.headers == null) {
|
||||||
|
this.headers = new HeaderBuilder();
|
||||||
|
}
|
||||||
return this.headers;
|
return this.headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class HttpSecurityTests {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
this.http = HttpSecurity.http();
|
this.http = HttpSecurity.http().headers().and();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user