Skip to content

Conversation

@Gautam-aman
Copy link

Background

Session concurrency control relies on principal equality when resolving
existing sessions. For OAuth2/OIDC logins, the principal is typically an
Authentication whose underlying principal (e.g. DefaultOidcUser)
uses attribute-based equality.

Since attributes such as nonce, jti, and sid differ per authentication,
session lookups fail and maximumSessions becomes ineffective.

Approach

When the principal is an Authentication, this change keys session registry
entries by Authentication#getName(), which represents the stable user
identity in Spring Security.

Existing behavior is preserved for non-Authentication principals.

Tests

Adds a regression test demonstrating correct session resolution when using
distinct Authentication instances with the same name.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 30, 2026
@Gautam-aman Gautam-aman force-pushed the fix-session-registry-authentication-key branch from 45d5308 to 11a6216 Compare January 30, 2026 18:45
@rwinch rwinch force-pushed the fix-session-registry-authentication-key branch from 11a6216 to 8fee53b Compare February 2, 2026 19:41
@rwinch
Copy link
Member

rwinch commented Feb 2, 2026

FYI I rebased based off origin/main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants