-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Oidc Logout Improvements #15540
Oidc Logout Improvements #15540
Conversation
@ch4mpy would you please look over this PR as see if is addresses your concerns about CSRF and Spring Session? |
@jzheaux I can confirm that, when building the branch for this PR locally, Back-Channel Logout works in this project of mine. The OP is Keycloak. The RP used to trigger the Back-Channel Logout is Keycloak's user account management. The RP receiving the Back-Channel Logout request is a spring-cloud-gateway instance (the reactive version) configured with:
I can confirm too that configuring the Back-Channel logout URI works as documented in your comment above. But warning: I had to configure a custom URI because the port for the "internal" request was determined using the original request instead of application properties. My client is behind a reverse proxy that uses a custom hostname and a path prefix for the BFF. The port for the proxy is 80 and the port for the Spring client with
|
...k/security/config/annotation/web/configurers/oauth2/client/OidcBackChannelLogoutHandler.java
Show resolved
Hide resolved
.../java/org/springframework/security/config/web/server/OidcBackChannelServerLogoutHandler.java
Show resolved
Hide resolved
e59dba7
to
faf4ce7
Compare
This component already uses by default a URI that doesn't require a CSRF token and aalready allows for configuring a cookie name. So, by making it public and configurable in the DSL, both of these tickets quite naturally close. Closes spring-projectsgh-13841 Closes spring-projectsgh-14904
@jzheaux I like what you did with the |
This brings support for #13841 and #14904.
To configure OIDC Back-Channel logout to reuse the Back-Channel endpoint to invalidate each individual session (thus removing the need for the CSRF token), configure OIDC logout in the following way:
NOTE that for simplicity, this changes the default internal URI. Since it changes it to point back to the OIDC back-channel URL itself, I believe this will go unnoticed by most applications. That said, in case you need your URI to stay as-is, you can specify the URI as follows:
To configure OIDC Back-Channel Logout with a different cookie name, configure it as follows:
Or it can also be specified in the DSL directly: