Skip to content

Commit 6f3a1fe

Browse files
committed
Polish kotlin.adoc
Issue gh-14384
1 parent 63556b6 commit 6f3a1fe

File tree

1 file changed

+9
-8
lines changed
  • docs/modules/ROOT/pages/servlet/configuration

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
[[kotlin-config]]
33
= Kotlin Configuration
4+
45
Spring Security Kotlin configuration has been available since Spring Security 5.3.
56
It lets users configure Spring Security by using a native Kotlin DSL.
67

@@ -23,27 +24,27 @@ import org.springframework.security.config.annotation.web.invoke
2324
2425
@Bean
2526
open fun filterChain(http: HttpSecurity): SecurityFilterChain {
26-
http {
27+
http {
2728
authorizeHttpRequests {
2829
authorize(anyRequest, authenticated)
2930
}
30-
formLogin { }
31-
httpBasic { }
31+
formLogin { }
32+
httpBasic { }
3233
}
3334
return http.build()
3435
}
3536
----
3637

3738
[NOTE]
38-
Make sure that import the `invoke` function in your class, sometimes the IDE will not auto-import it causing compilation issues.
39+
Make sure to import the `invoke` function in your class, as the IDE will not always auto-import the method, causing compilation issues.
3940

4041
The default configuration (shown in the preceding listing):
4142

4243
* Ensures that any request to our application requires the user to be authenticated
4344
* Lets users authenticate with form-based login
4445
* Lets users authenticate with HTTP Basic authentication
4546

46-
Note that this configuration is parallels the XML namespace configuration:
47+
Note that this configuration parallels the XML namespace configuration:
4748

4849
[source,xml]
4950
----
@@ -58,13 +59,13 @@ Note that this configuration is parallels the XML namespace configuration:
5859

5960
We can configure multiple `HttpSecurity` instances, just as we can have multiple `<http>` blocks.
6061
The key is to register multiple `SecurityFilterChain` ``@Bean``s.
61-
The following example has a different configuration for URL's that start with `/api/`:
62+
The following example has a different configuration for URLs that start with `/api/`:
6263

6364
[source,kotlin]
6465
----
65-
@Configuration
6666
import org.springframework.security.config.annotation.web.invoke
6767
68+
@Configuration
6869
@EnableWebSecurity
6970
class MultiHttpSecurityConfig {
7071
@Bean <1>
@@ -104,7 +105,7 @@ class MultiHttpSecurityConfig {
104105

105106
<1> Configure Authentication as usual.
106107
<2> Create an instance of `SecurityFilterChain` that contains `@Order` to specify which `SecurityFilterChain` should be considered first.
107-
<3> The `http.antMatcher` states that this `HttpSecurity` is applicable only to URLs that start with `/api/`
108+
<3> The `http.securityMatcher` states that this `HttpSecurity` is applicable only to URLs that start with `/api/`
108109
<4> Create another instance of `SecurityFilterChain`.
109110
If the URL does not start with `/api/`, this configuration is used.
110111
This configuration is considered after `apiFilterChain`, since it has an `@Order` value after `1` (no `@Order` defaults to last).

0 commit comments

Comments
 (0)