Skip to content

Restore session auth context persistence after Shiro 2.2 upgrade#26150

Merged
dennisoelkers merged 2 commits into
masterfrom
fix/empty-session-auth-context
May 28, 2026
Merged

Restore session auth context persistence after Shiro 2.2 upgrade#26150
dennisoelkers merged 2 commits into
masterfrom
fix/empty-session-auth-context

Conversation

@thll
Copy link
Copy Markdown
Contributor

@thll thll commented May 28, 2026

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_context attribute that carries the IdP SessionIndex, so SLO couldn't match anything to terminate.

Shiro 2.2.0 added a session-fixation defense that deletes a session between authenticate() and createSubject(). This caused our session attributes that were written by an AuthenticationListener to get lost.

This PR addresses that by replacing the AuthenticationListener-based persistence of SessionAuthContext with an override of Shiro's onSuccessfulLogin hook on DefaultSecurityManager. The hook fires after createSubject(), 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 SessionAuthContext handling more robust and also more obvious.

/nocl

@thll thll added the e2e-tests Run PR build with e2e tests. label May 28, 2026
@thll thll marked this pull request as ready for review May 28, 2026 11:59
@thll thll requested review from bernd and kroepke May 28, 2026 12:00
Copy link
Copy Markdown
Member

@dennisoelkers dennisoelkers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and fixes the issue! Thank you!

@dennisoelkers dennisoelkers merged commit af9087f into master May 28, 2026
25 checks passed
@dennisoelkers dennisoelkers deleted the fix/empty-session-auth-context branch May 28, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e-tests Run PR build with e2e tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants