Browse Source

Updated the Configuration examples in docs

Closes gh-14384
pull/14413/head
Siddharth1605 2 years ago committed by Steve Riesenberg
parent
commit
e11ed2d313
No known key found for this signature in database
GPG Key ID: 3D0169B18AB8F0A9
  1. 6
      docs/modules/ROOT/pages/servlet/configuration/java.adoc
  2. 6
      docs/modules/ROOT/pages/servlet/configuration/kotlin.adoc

6
docs/modules/ROOT/pages/servlet/configuration/java.adoc

@ -173,7 +173,7 @@ It is configured with the following default implementation: @@ -173,7 +173,7 @@ It is configured with the following default implementation:
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.authorizeRequests(authorize -> authorize
.authorizeHttpRequests(authorize -> authorize
.anyRequest().authenticated()
)
.formLogin(withDefaults())
@ -290,7 +290,7 @@ public class MyCustomDsl extends AbstractHttpConfigurer<MyCustomDsl, HttpSecurit @@ -290,7 +290,7 @@ public class MyCustomDsl extends AbstractHttpConfigurer<MyCustomDsl, HttpSecurit
[NOTE]
====
This is actually how methods like `HttpSecurity.authorizeRequests()` are implemented.
This is actually how methods like `HttpSecurity.authorizeHttpRequests()` are implemented.
====
You can then use the custom DSL:
@ -360,7 +360,7 @@ For example, to configure the `filterSecurityPublishAuthorizationSuccess` proper @@ -360,7 +360,7 @@ For example, to configure the `filterSecurityPublishAuthorizationSuccess` proper
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.authorizeRequests(authorize -> authorize
.authorizeHttpRequests(authorize -> authorize
.anyRequest().authenticated()
.withObjectPostProcessor(new ObjectPostProcessor<FilterSecurityInterceptor>() {
public <O extends FilterSecurityInterceptor> O postProcess(

6
docs/modules/ROOT/pages/servlet/configuration/kotlin.adoc

@ -24,7 +24,7 @@ import org.springframework.security.config.annotation.web.invoke @@ -24,7 +24,7 @@ import org.springframework.security.config.annotation.web.invoke
@Bean
open fun filterChain(http: HttpSecurity): SecurityFilterChain {
http {
authorizeRequests {
authorizeHttpRequests {
authorize(anyRequest, authenticated)
}
formLogin { }
@ -81,7 +81,7 @@ class MultiHttpSecurityConfig { @@ -81,7 +81,7 @@ class MultiHttpSecurityConfig {
open fun apiFilterChain(http: HttpSecurity): SecurityFilterChain {
http {
securityMatcher("/api/**") <3>
authorizeRequests {
authorizeHttpRequests {
authorize(anyRequest, hasRole("ADMIN"))
}
httpBasic { }
@ -92,7 +92,7 @@ class MultiHttpSecurityConfig { @@ -92,7 +92,7 @@ class MultiHttpSecurityConfig {
@Bean <4>
open fun formLoginFilterChain(http: HttpSecurity): SecurityFilterChain {
http {
authorizeRequests {
authorizeHttpRequests {
authorize(anyRequest, authenticated)
}
formLogin { }

Loading…
Cancel
Save