Fix Reactive OAuth2 Kotlin DSL examples

Closes gh-10580
This commit is contained in:
Steve Riesenberg 2021-12-03 17:21:02 -06:00 committed by Eleftheria Stein-Kousathana
parent aa3c883f87
commit 1896a5e669
4 changed files with 15 additions and 45 deletions

View File

@ -162,7 +162,7 @@ class SecurityConfig {
@Bean
fun securityFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
authorizeExchange {
authorize(anyExchange, authenticated)
}
@ -170,8 +170,6 @@ class SecurityConfig {
authorizationRequestResolver = authorizationRequestResolver(customClientRegistrationRepository)
}
}
return http.build()
}
private fun authorizationRequestResolver(
@ -282,13 +280,11 @@ class OAuth2ClientSecurityConfig {
@Bean
fun securityFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
oauth2Client {
authorizationRequestRepository = authorizationRequestRepository()
}
}
return http.build()
}
}
----
@ -363,13 +359,11 @@ class OAuth2ClientSecurityConfig {
@Bean
fun securityFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
oauth2Client {
authenticationManager = authorizationCodeAuthenticationManager()
}
}
return http.build()
}
private fun authorizationCodeAuthenticationManager(): ReactiveAuthenticationManager {

View File

@ -55,7 +55,7 @@ class OAuth2ClientSecurityConfig {
@Bean
fun securityFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
oauth2Client {
clientRegistrationRepository = clientRegistrationRepository()
authorizedClientRepository = authorizedClientRepository()
@ -64,8 +64,6 @@ class OAuth2ClientSecurityConfig {
authenticationManager = authenticationManager()
}
}
return http.build()
}
}
----

View File

@ -60,7 +60,7 @@ class OAuth2LoginSecurityConfig {
@Bean
fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
oauth2Login {
authenticationConverter = authenticationConverter()
authenticationMatcher = authenticationMatcher()
@ -75,8 +75,6 @@ class OAuth2LoginSecurityConfig {
securityContextRepository = securityContextRepository()
}
}
return http.build()
}
}
----
@ -158,7 +156,7 @@ class OAuth2LoginSecurityConfig {
@Bean
fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
exceptionHandling {
authenticationEntryPoint = RedirectServerAuthenticationEntryPoint("/login/oauth2")
}
@ -166,8 +164,6 @@ class OAuth2LoginSecurityConfig {
authorizationRequestResolver = authorizationRequestResolver()
}
}
return http.build()
}
private fun authorizationRequestResolver(): ServerOAuth2AuthorizationRequestResolver {
@ -243,13 +239,11 @@ class OAuth2LoginSecurityConfig {
@Bean
fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
oauth2Login {
authenticationMatcher = PathPatternParserServerWebExchangeMatcher("/login/oauth2/callback/{registrationId}")
}
}
return http.build()
}
}
----
@ -369,11 +363,9 @@ class OAuth2LoginSecurityConfig {
@Bean
fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
oauth2Login { }
}
return http.build()
}
@Bean
@ -458,11 +450,9 @@ class OAuth2LoginSecurityConfig {
@Bean
fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
oauth2Login { }
}
return http.build()
}
@Bean
@ -536,11 +526,9 @@ class OAuth2LoginSecurityConfig {
@Bean
fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
oauth2Login { }
}
return http.build()
}
@Bean
@ -594,11 +582,9 @@ class OAuth2LoginSecurityConfig {
@Bean
fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
oauth2Login { }
}
return http.build()
}
@Bean
@ -730,7 +716,7 @@ class OAuth2LoginSecurityConfig {
@Bean
fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
authorizeExchange {
authorize(anyExchange, authenticated)
}
@ -739,8 +725,6 @@ class OAuth2LoginSecurityConfig {
logoutSuccessHandler = oidcLogoutSuccessHandler()
}
}
return http.build()
}
private fun oidcLogoutSuccessHandler(): ServerLogoutSuccessHandler {

View File

@ -341,14 +341,12 @@ class OAuth2LoginSecurityConfig {
@Bean
fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
authorizeExchange {
authorize(anyExchange, authenticated)
}
oauth2Login { }
}
return http.build()
}
}
----
@ -411,14 +409,12 @@ class OAuth2LoginConfig {
@Bean
fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
authorizeExchange {
authorize(anyExchange, authenticated)
}
oauth2Login { }
}
return http.build()
}
@Bean
@ -505,14 +501,12 @@ class OAuth2LoginConfig {
@Bean
fun securityWebFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain {
http {
return http {
authorizeExchange {
authorize(anyExchange, authenticated)
}
oauth2Login { }
}
return http.build()
}
@Bean