-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Enhanced Logout support #4481
Comments
Me and @pedroigor has been working on some plans around logout: Stateless applications can check validity of ID token using token introspection endpoint. However, this will have a performance impact as every request would require a request to the IdP. An improvement to the above is the addition of a token introspection cache. This will not only be useful for ID tokens, but also for access tokens. For opaque tokens applications need to invoke the token introspection endpoint for every request. The token introspection cache should be configurable with a cache expiration. Applications would first check the token by invoking introspection cache if not found it would invoke the token introspection endpoint. The expiration should be configurable on a per-token type (ID or access). As a final improvement once OIDC backchannel logout mechanism is added the expiration in the token introspection cache can be increased as the application would be able to retrieve a logout request from the IdP which would remove the entry from the cache. This would require invalidating all entries in the cache for a specific session. |
1 and 2 are high priority |
Pedro:
SB: We can probably delay it as needed |
@sberyozkin can you clarify what you mean about when their sessions are invalidated and silent re-authentication? |
@stianst sorry I missed your question and I don't recall now what I meant or even where I said it :-). |
@stianst oh sorry, that was from a quote by Pedro @pedroigor :-) |
With |
I thought there already was logout support through RP initiated endpoint (which is a standard thing) and this is more about polish. @pedroigor ? |
@stianst you mean by calling |
@stianst That quote was in the beginning when I was investigating the different options to logout. By The There is no support yet for RP logout. |
Is there any way to get the |
With |
Hi @stianst, @pedroigor, All, I agree, IMHO this issue is becoming the major issue for |
I agree this is an important area to work on. Will have a chat with @pedroigor on what we have today, and we can create some plan for how to make things better in the not to distant future. |
Yeah, we need this one ASAP. |
Hi Stian, Pedro, thanks, it will be super great :-) |
Adding my 2 cents to this one: For initiating the logout that's simple it's RP initiated logout endpoint, which we support. For pushing logout that's more tricky. Front-channel logout is pretty much EOL due to third party cookies becoming blocked (Safari already blocks these, and Chrome will follow suite in 2022). That leaves two options: a) Stateless - we basically need to invoke token introspection endpoint on each request to validate the token. This can be used in combination with a token introspection cache with some timeout. This is what I was thinking could be a generic purpose microservice rather than something that is baked into the app itself b) Stateful - this would be OIDC backchannel logout requests, which we don't support in Keycloak at the moment. |
Adding some more details: I can think of a few options to invalidate the "authentication context" for stateless applications when logout is initiated from a different application, which is important since we are talking about SSO here:
2. Front-channel logout - this is not covered by all IdPs, it's error prone and more importantly it requires access to third party cookies, which as mentioned above is EOL. It requires access to third party cookies basically due to it relying on embedding logout pages from the RP in a hidden iframe within a page from the IdP.
What we should do for stateless applications based on this reasoning is: a) Add support to invoke RP initated logout endpoint. Support in IdP can be inteferred from discovery endpoint b) Add support to refresh ID tokens when they expire For statefull applications (is that even a thing in Quarkus) we should add support for OIDC backchannel specification. |
Yeah, a combination of both approaches should be OK. Although not yet bulletproof, as you mentioned (not surprisingly when talking about global logout). |
@stianst thanks for the detailed analysis, yes, as @pedroigor mentions, we can start from a) + b) (I can check what can be done around b) with Vertx) and depending on the demand I guess - c) (stateful backchannel logout).
This is going to be a real fun :-) |
When building an app with Qute Templating, then yeah, you have a stateful application. |
Not sure if logout mechanism should be pluggable per say. I would perhaps rather argue we should have configurable alternatives/strategies. quarkus-oidc for backchannel logout needs to be able to receive request at a specific endpoint. Wouldn't say that should be a jax-rs endpoint though, but rather something more low-level than that. For initiating logout I would assume a Java method is called, rather than quarkus-oidc exposing a "initiate logout endpoint" as the latter could easily be abused. |
To initiate a logout you don't need a java method call but just the app itself to reach the logout endpoint. Considering we agreed about starting with RP-Initiated, after the logout is initiated by the app the server should expect a request to the Regarding backchannel, are we considering to include it in the initial scope? |
I think we should split this work into two issues:
|
"To initiate a logout you don't need a java method call but just the app itself to reach the logout endpoint. Considering we agreed about starting with RP-Initiated, after the logout is initiated by the app the" Not sure what you mean about that. The app needs to know the logout endpoint, and it also needs ti include the id_token_hint. You don't want the app to have to create the logout endpoint itself. |
@sberyozkin Sent a PR with the initial set of changes. Do you think we should have something in the guide for this too? Or the documentation added to the new configuration options are enough ? I'll spend a bit more time trying to figure out a way to prevent the logout endpoint from CSRF attacks. As we discussed, it seems there is no way to prevent CSRF without impacting UX. At the same time, the logout is not so risky and OPs can prevent that by asking the user if they want to log out as mentioned in the specs. So ... The way it is, it is quite simple. |
[fixes #4481] - RP-Initiated Logout and session verification
Hello @pedroigor @stianst is there any backchannel logout support implemented? Reading this issue i can't find a clue nor i can find in the quakus documentation. I guess that if supported a logout consumer is published by the quarkus oidc extension. Is that right? |
Description
The authenticated users should have an option to logout out of OIDC adapter protected web applications.
The recommendation from the Keycloak experts is to have a combination of the RP-Initiating logout in combination with initial form of the OIDC back channel logout flow.
@stianst @pedroigor FYI
Update: Pedro has already done some work around supporting it as part of the code flow PR
The text was updated successfully, but these errors were encountered: