parent
8bb5875595
commit
590aef0af1
|
@ -16,19 +16,20 @@
|
|||
|
||||
package org.springframework.security.config.annotation.web
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest
|
||||
import org.springframework.security.authentication.AuthenticationDetailsSource
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity
|
||||
import org.springframework.security.config.annotation.web.configurers.oauth2.client.OAuth2LoginConfigurer
|
||||
import org.springframework.security.config.annotation.web.oauth2.login.AuthorizationEndpointDsl
|
||||
import org.springframework.security.config.annotation.web.oauth2.login.RedirectionEndpointDsl
|
||||
import org.springframework.security.config.annotation.web.oauth2.login.TokenEndpointDsl
|
||||
import org.springframework.security.config.annotation.web.oauth2.login.UserInfoEndpointDsl
|
||||
import org.springframework.security.config.annotation.web.configurers.oauth2.client.OAuth2LoginConfigurer
|
||||
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientService
|
||||
import org.springframework.security.oauth2.client.oidc.session.OidcSessionRegistry
|
||||
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository
|
||||
import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository
|
||||
import org.springframework.security.web.authentication.AuthenticationFailureHandler
|
||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler
|
||||
import jakarta.servlet.http.HttpServletRequest
|
||||
|
||||
/**
|
||||
* A Kotlin DSL to configure [HttpSecurity] OAuth 2.0 login using idiomatic Kotlin code.
|
||||
|
@ -61,6 +62,7 @@ class OAuth2LoginDsl {
|
|||
var loginProcessingUrl: String? = null
|
||||
var permitAll: Boolean? = null
|
||||
var authenticationDetailsSource: AuthenticationDetailsSource<HttpServletRequest, *>? = null
|
||||
var oidcSessionRegistry: OidcSessionRegistry? = null
|
||||
|
||||
private var defaultSuccessUrlOption: Pair<String, Boolean>? = null
|
||||
private var authorizationEndpoint: ((OAuth2LoginConfigurer<HttpSecurity>.AuthorizationEndpointConfig) -> Unit)? = null
|
||||
|
@ -236,6 +238,7 @@ class OAuth2LoginDsl {
|
|||
redirectionEndpoint?.also { oauth2Login.redirectionEndpoint(redirectionEndpoint) }
|
||||
userInfoEndpoint?.also { oauth2Login.userInfoEndpoint(userInfoEndpoint) }
|
||||
authenticationDetailsSource?.also { oauth2Login.authenticationDetailsSource(authenticationDetailsSource) }
|
||||
oidcSessionRegistry?.also { oauth2Login.oidcSessionRegistry(oidcSessionRegistry) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.springframework.security.config.web.server
|
|||
import org.springframework.security.authentication.ReactiveAuthenticationManager
|
||||
import org.springframework.security.core.Authentication
|
||||
import org.springframework.security.oauth2.client.ReactiveOAuth2AuthorizedClientService
|
||||
import org.springframework.security.oauth2.client.oidc.server.session.ReactiveOidcSessionRegistry
|
||||
import org.springframework.security.oauth2.client.registration.ReactiveClientRegistrationRepository
|
||||
import org.springframework.security.oauth2.client.web.server.ServerAuthorizationRequestRepository
|
||||
import org.springframework.security.oauth2.client.web.server.ServerOAuth2AuthorizationRequestResolver
|
||||
|
@ -70,6 +71,7 @@ class ServerOAuth2LoginDsl {
|
|||
var authorizationRedirectStrategy: ServerRedirectStrategy? = null
|
||||
var authenticationMatcher: ServerWebExchangeMatcher? = null
|
||||
var loginPage: String? = null
|
||||
var oidcSessionRegistry: ReactiveOidcSessionRegistry? = null
|
||||
|
||||
internal fun get(): (ServerHttpSecurity.OAuth2LoginSpec) -> Unit {
|
||||
return { oauth2Login ->
|
||||
|
@ -86,6 +88,7 @@ class ServerOAuth2LoginDsl {
|
|||
authorizationRedirectStrategy?.also { oauth2Login.authorizationRedirectStrategy(authorizationRedirectStrategy) }
|
||||
authenticationMatcher?.also { oauth2Login.authenticationMatcher(authenticationMatcher) }
|
||||
loginPage?.also { oauth2Login.loginPage(loginPage) }
|
||||
oidcSessionRegistry?.also { oauth2Login.oidcSessionRegistry(oidcSessionRegistry) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue