Skip to content

Commit 0c0df51

Browse files
committed
Added ability to set ServerSecurityContextRepository in ServerHttpSecurityDsl
1 parent e541755 commit 0c0df51

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

config/src/main/kotlin/org/springframework/security/config/web/server/ServerHttpSecurityDsl.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package org.springframework.security.config.web.server
1919
import org.springframework.security.authentication.ReactiveAuthenticationManager
2020
import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository
2121
import org.springframework.security.web.server.SecurityWebFilterChain
22+
import org.springframework.security.web.server.context.ServerSecurityContextRepository
2223
import org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher
2324
import org.springframework.web.server.ServerWebExchange
2425
import org.springframework.web.server.WebFilter
@@ -65,6 +66,7 @@ operator fun ServerHttpSecurity.invoke(httpConfiguration: ServerHttpSecurityDsl.
6566
class ServerHttpSecurityDsl(private val http: ServerHttpSecurity, private val init: ServerHttpSecurityDsl.() -> Unit) {
6667

6768
var authenticationManager: ReactiveAuthenticationManager? = null
69+
var securityContextRepository: ServerSecurityContextRepository? = null
6870

6971
/**
7072
* Allows configuring the [ServerHttpSecurity] to only be invoked when matching the
@@ -718,6 +720,7 @@ class ServerHttpSecurityDsl(private val http: ServerHttpSecurity, private val in
718720
internal fun build(): SecurityWebFilterChain {
719721
init()
720722
authenticationManager?.also { this.http.authenticationManager(authenticationManager) }
723+
securityContextRepository?.also { this.http.securityContextRepository(securityContextRepository) }
721724
return this.http.build()
722725
}
723726
}

0 commit comments

Comments
 (0)