See gh-24604
This commit is contained in:
izeye
2020-12-23 21:46:10 +09:00
committed by Stephane Nicoll
parent e3d7ab0e3b
commit 5e3f618f9d
5 changed files with 19 additions and 19 deletions

View File

@@ -2439,10 +2439,10 @@ To configure Spring Security to require a secure channel for all (or some) reque
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
// Customize the application security
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
// Customize the application security
http.requiresChannel().anyRequest().requiresSecure();
return http.build();
return http.build();
}
----

View File

@@ -359,12 +359,12 @@ A typical Spring Security configuration might look something like the following
[source,java,indent=0]
----
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.requestMatcher(EndpointRequest.toAnyEndpoint()).authorizeRequests((requests) ->
requests.anyRequest().hasRole("ENDPOINT_ADMIN"));
http.httpBasic();
return http.build();
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.requestMatcher(EndpointRequest.toAnyEndpoint()).authorizeRequests((requests) ->
requests.anyRequest().hasRole("ENDPOINT_ADMIN"));
http.httpBasic();
return http.build();
}
----
@@ -388,12 +388,12 @@ Additionally, if Spring Security is present, you would need to add custom securi
[source,java,indent=0]
----
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.requestMatcher(EndpointRequest.toAnyEndpoint()).authorizeRequests((requests) ->
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.requestMatcher(EndpointRequest.toAnyEndpoint()).authorizeRequests((requests) ->
requests.anyRequest().permitAll());
return http.build();
}
return http.build();
}
----
NOTE: In both the examples above, the configuration applies only to the actuator endpoints.