Do Not Wire Default OidcSessionStrategy without OidcLogoutConfigurer

Closes gh-14558
This commit is contained in:
Josh Cummings
2024-01-29 17:20:56 -07:00
parent eea4279fae
commit 3ab323663a
6 changed files with 172 additions and 13 deletions

View File

@@ -170,6 +170,33 @@ open fun filterChain(http: HttpSecurity): SecurityFilterChain {
----
======
Then, you need a way listen to events published by Spring Security to remove old `OidcSessionInformation` entries, like so:
[tabs]
======
Java::
+
[source=java,role="primary"]
----
@Bean
public HttpSessionEventListener sessionEventListener() {
return new HttpSessionEventListener();
}
----
Kotlin::
+
[source=kotlin,role="secondary"]
----
@Bean
open fun sessionEventListener(): HttpSessionEventListener {
return HttpSessionEventListener()
}
----
======
This will make so that if `HttpSession#invalidate` is called, then the session is also removed from memory.
And that's it!
This will stand up the endpoint `+/logout/connect/back-channel/{registrationId}+` which the OIDC Provider can request to invalidate a given session of an end user in your application.