-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
oauth2: Consider implementing OIDC Session Management #834
Comments
This would be a very nasty way to go on iOS because the security model is moving towards using SFAuthenticationSession (iOS11) and ASWebAuthenticationSession (iOS12+) which create out-of-process (sandboxed) Safari instances that the app has no control over. Thus there is no way to invisibly call an iframe and the cookies themselves that are used for tracking the session are not directly accessible. The only feasible means to do session management assuming this model is adopted is having a way to manually revoke the token which would also kill the session remember token. |
Good point, this sort of confirms my negative bias towards the spec. We'll definitely figure something out. I have no iOS experience however. Just to confirm, what you're saying is that a REST call with the token which revokes the session completely is the way to go here? |
That would be my preference and I don’t see any other way that would really work. They aren’t mutually exclusive though so have a revoke endpoint that purges the session could be done for use cases like admin or mobile. It might be good though to keep these separate. An admin endpoint would want to arbitrarily revoke sessions (token or users) but a POST to a /logout for a given session could simply use the Authorization header and return a 204 thus only expiring the session token associated with the given user. |
We have now all the endpoints to deal with basic logout flows. I still think this spec is outdated and very complicated. The OIDC foundation doesn't certify this spec either. Closing. |
I'm reopening this because the SSO requirements come up over and over again, and hydra lacks a peer reviewed flow for this. It makes sense to implement at least some of these flows. |
I see a big problem with the currently implemented way for revoking sessions. First of (because I saw false assumptions spread over other sides): revoking the session on hydra is obviously required for SPA applications, since even if they'd forget the access token, the next silent refresh would automatically get new tokens (as long as the user has chosen to remember the login). Anyway, the problem I'm seeing with |
Architecture/implementation notes: Specs front/backchannel log out seem much more important than OpenID Connect Session Management:
For logout, it makes sense to add another UI interaction:
OIDC Front Channel Implementation summaryClients that support OIDC Front Channel logout register the following values during OIDC DCR:
The log out page then should render a list of iframes:
The values for that can be retrieved from the Hydra should advertise at OIDC Discovery:
The ID Token must contain a
Example iframe request:
Back-channel logoutDiscovery:
Client meta:
The first value, if set, indicates that backchannel log out should run if we log out a user. When
The ID Token has the following claims. BE AWARE THAT THE
|
Well, that's not completely true. When you use the authorization code flow, which is the currently recommended flow for SPAs, you do in fact get a refresh token. But as the local storage is not considered a secure storage, both the access token and the refresh token are only kept in memory, so that the access token can be used against the resource API and the refresh token can be used to refresh the access token while the tab is open. Only as soon as the page is reloaded, silent renew is required to obtain a new set of tokens. So at this point it is required to remove the hydra session in case the user wants to truly log out.
This might not be important for non-SPAs, but SPAs themself are more vulnerable to this. Do I see it correctly from your second post that the Front Channel logout would solve this problem? |
Cycling back since you've updated your initial comment:
This is not true, removing the login state at Hydra implies that silent refresh will fail, thus new authorization is required.
That's actually the trade-off the official OIDC spec makes wrt session management. Passing an
The current flow mimics the least common (security) denominator. It's not great, but it's also not a major security flaw.
As long as an In general there should be a user interaction before logging someone out of the OP. We'll probably not do that for 1.0 as it's too much work but instead enforce |
Well, that is exactly what I want, when the user clicks "logout" in the application :) |
Then your use-case is already supported! |
You mean, by redirecting the user to |
Not true, the URL is not hardcoded. You can set it via configuration. What's currently not possible is whitelisting redirect URLs on a pre-client basis. Leaving the URL open is a security thread (open redirect) which is why it has to be whitelisted. |
Well, by hardcoded I meant what is defined globally for Hydra. And yeah, obviously it needs to be whitelisted on a per-client basis. |
Yes, redirection to a configured-per-app logged out url is needed. Else this tightly binds all the authorized apps on a hydra server to one logout flow. |
I have run into this question/problem myself. What I'm seeing now is that I have 1 API to revoke sessions from my IDP ( |
I'm not really sure why this issue has been closed. Yes you implemented front-/backchannel logout but not OIDC Session Management. Maybe I'm missing something obvious - but I can't figure out how I can implement same functionality with just frontchannel logout. Let me clarify my needs:
As far as i understand OIDC Session Management would help me with that. Or maybe I'm misionformed and there is some other way to achieve this? I would be thankful for a nudge to the right path then. |
I think this was by accident due to GitHub Projects! |
Actually no, this was closed by a commit that introduced OIDC Front/Backchannel logout. I don't think that there is a lot of additional benefit to OIDC Session Management. Closing again.
OIDC SM can help with logout but so do OIDC Front/Backchannel Logout that are already implemented! |
This has come up once or twice now, where developers want users to be able to log out of all applications. OIDC has a spec for that (or rather 3 different drafts) and the flows are summarized here.
Personally, I'm absolutely not a fan of invisible iframes, weird inter-iframe javascript communication, and in general those specs. Let's see how they evolve and consider implementing them once they leave draft status and are an official spec.
The text was updated successfully, but these errors were encountered: