Repository navigation
Reject online refresh tokens for sessions in logout states - #54753
Merged
Merged
Conversation
Check user and client session logout state before refreshing tokens, preserving pending logout state and preventing idle timestamp updates. Keep offline and service-account refresh behavior unchanged. Closes keycloak#54484 Signed-off-by: Lukas Hanusovsky <lhanusov@redhat.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the logout-state refresh-token restrictions.
No open issues 🎉
What changed in this PR
This PR addresses #54484 by rejecting online refresh tokens when the user or client session is in a logout state, including incomplete front-channel logout flows.
Changes:
- Adds logout-state checks before refresh processing, preserving pending logout state and preventing idle timestamp updates.
- Adds tests for rejected refreshes, unchanged session state and timestamps, and offline refresh after logout.
- Documents the online refresh restriction and offline-token exemption.
| File | Description |
|---|---|
tests/base/src/test/java/org/keycloak/tests/oauth/RefreshTokenTest.java |
Tests logout-state rejection, session preservation, and offline refresh. |
services/src/main/java/org/keycloak/protocol/oidc/TokenManager.java |
Rejects online refreshes for user and client sessions in logout states. |
docs/documentation/server_admin/topics/sessions/offline.adoc |
Clarifies refresh-token behavior once logout begins. |
Review effort: Balanced
mposolda
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Check user and client session logout state before refreshing tokens, preserving pending logout state and preventing idle timestamp updates. Keep offline and service-account refresh behavior unchanged.
Closes #54484