Reputation: 527
I want to implement this handler:
@Component
internal class CustomConcurrentSessionControlSuccessHandler(
reactiveSessionRegistry: ReactiveSessionRegistry,
maximumSessionsExceededHandler: ServerMaximumSessionsExceededHandler
) : ServerAuthenticationSuccessHandler {
private val logger = LoggerFactory.getLogger(CustomConcurrentSessionControlSuccessHandler::class.java)
private val delegate: ConcurrentSessionControlServerAuthenticationSuccessHandler =
ConcurrentSessionControlServerAuthenticationSuccessHandler(
reactiveSessionRegistry,
maximumSessionsExceededHandler
)
init {
// configure the default session limit
delegate.setSessionLimit(SessionLimit.of(1))
}
// override method
override fun onAuthenticationSuccess(
webFilterExchange: WebFilterExchange,
authentication: Authentication
): Mono<Void> {
logger.info("Successfully authenticated: {}", authentication.name)
return delegate.onAuthenticationSuccess(webFilterExchange, authentication)
}
}
But I cannot implement a Mongo Session equivalent of this, since
public SpringSessionBackedReactiveSessionRegistry(
org. springframework. session. ReactiveSessionRepository<S> sessionRepository,
org. springframework. session. ReactiveFindByIndexNameSessionRepository<S> indexedSessionRepository )
The two repositories, MongoIndexedSessionRepository implements FindByIndexNameSessionRepository but is not reactive, and ReactiveMongoSessionRepository is reactive but does not implement FindByIndexNameSessionRepository?
Because I cannot create a reactiveSessionRegistry, I cannot implement a ConcurrentSessionControlServerAuthenticationSuccessHandler...
Any ideas?
Upvotes: 0
Views: 72