-
Notifications
You must be signed in to change notification settings - Fork 0
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
Is there a way to invalidate session cookie, when refresh token expires #1499
Comments
I've investigated it a bit more, and I can see I could implement something like this in the RefreshTokenStore (whenever a refresh token is removed) or in my own implementation of DefaultRefreshTokenService. I could query session store and remove any sessions referenced to a given user/client. But perhaps there's a better way to do it, and if there are any counterpoint/or would it be considered bad practice by adding such functionality in the classes I've mentioned. |
Setting the CoordinateClientLifetimesWithUserSession option in combination with server side sessions should work. Both the session lifetime and refresh token lifetime should be the same. The session by default has sliding expiration. Whenever the refresh token is used, then the session is renewed. So if the refresh token isn't used and expires after X hours, then the session will expire at the same time. |
@skatanski Did my comment make things clear for you? If so I'd like to close the issue. |
Hi @RolandGuijt so I've set both:
However, after i run following scenario:
I was expecting that actual login form would show up because the session should have expired along with the refresh token. |
Interestingly I've found following issue, which seems to overlap with mine: |
So I've digged a bit more into it, and my current solution to terminate user session on failed refresh token validation is following:
This way whenever absolute refresh token expires, session will get terminated as well. I'd need to add client flag to enable it per client. |
Version: 7.0.8
.net 8
From documentation, I can see it's possible to synchronize refresh token's lifetime with session cookie in a way that clears refresh tokens when session cookie expires. I can't find, if the other way around is possible - to make it so that session cookie expires, when the refresh token expires. We'd like the user on the front-end side to have to manually re-authenticate, when refresh tokens have expired, with this change being triggered by the back-end.
The text was updated successfully, but these errors were encountered: