Restore session auth context persistence after Shiro 2.2 upgrade#26150
Merged
Conversation
dennisoelkers
approved these changes
May 28, 2026
Member
dennisoelkers
left a comment
There was a problem hiding this comment.
Looks good and fixes the issue! Thank you!
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.
SAML Single Logout stopped terminating Graylog sessions after the recent Shiro 2.1.0 → 2.2.0 upgrade: when the IdP logged a user out, their Graylog session stayed alive. Persisted sessions were missing the
auth_contextattribute that carries the IdPSessionIndex, so SLO couldn't match anything to terminate.Shiro 2.2.0 added a session-fixation defense that deletes a session between
authenticate()andcreateSubject(). This caused our session attributes that were written by anAuthenticationListenerto get lost.This PR addresses that by replacing the
AuthenticationListener-based persistence ofSessionAuthContextwith an override of Shiro'sonSuccessfulLoginhook onDefaultSecurityManager. The hook fires aftercreateSubject(), so the attribute is written to the post-auth session that actually gets persisted. The old listener is removed.After completing this PR, I've noticed that this is a known regression and that an upstream fix will be available with the next release. I still think that we should merge this PR because it makes the
SessionAuthContexthandling more robust and also more obvious./nocl