Fix Kotlin example in authorize-http-requests.adoc

- Consistency: Replaced mix of tabs/spaces with spaces indentation
This commit is contained in:
Alexander Münch 2024-05-22 16:35:59 +02:00 committed by Marcus Hert Da Coregio
parent 9744cc44d2
commit df59516b18
1 changed files with 13 additions and 12 deletions

View File

@ -185,15 +185,15 @@ Java::
[source,java,role="primary"]
----
@Bean
SecurityFilterChain web(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests((authorize) -> authorize
.requestMatchers("/endpoint").hasAuthority("USER")
.anyRequest().authenticated()
)
public SecurityFilterChain web(HttpSecurity http) throws Exception {
http
.authorizeHttpRequests((authorize) -> authorize
.requestMatchers("/endpoint").hasAuthority("USER")
.anyRequest().authenticated()
)
// ...
return http.build();
return http.build();
}
----
@ -202,14 +202,15 @@ Kotlin::
[source,kotlin,role="secondary"]
----
@Bean
SecurityFilterChain web(HttpSecurity http) throws Exception {
http {
fun web(http: HttpSecurity): SecurityFilterChain {
http {
authorizeHttpRequests {
authorize("/endpoint", hasAuthority("USER"))
authorize(anyRequest, authenticated)
}
}
return http.build();
}
return http.build()
}
----