Skip to content

Include the fix for shared user token refreshes in ATM 4.3.x - #372

Merged
pgermishuys merged 3 commits into
releases/atm/4.3.xfrom
pg/atm-4.3-refresh-per-parameters
Oct 16, 2026
Merged

pgermishuys merged 3 commits into
releases/atm/4.3.xfrom
pg/atm-4.3-refresh-per-parameters

Conversation

@pgermishuys

@pgermishuys pgermishuys commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Brings #366 to 4.3.x, which fixes #360. Concurrent user token refreshes that share a refresh token were merged on the refresh token alone, so with resource isolation a request for one resource could get the access token issued for another. The default IUserTokenRequestConcurrencyControl now only merges requests that would send the same token request. The interface gets an ExecuteWithConcurrencyControlAsync overload that receives the request parameters; it's a default interface method, so existing implementations keep compiling and behave as before.

Combining different parameters with one-time-use (rotating) refresh tokens isn't supported, and the interface docs say so.

Cherry-picked the three commits of #366 with git cherry-pick -x, no conflicts.

Merge order: fourth of five, after #371. Until the earlier ones merge, this PR also shows their commits.

Concurrent user token refreshes were merged on the refresh token alone, so
a request for one resource could get the access token issued for another
(#360).

The default IUserTokenRequestConcurrencyControl now only merges requests
that would send the same token request: the same refresh token and DPoP
key, resource, scope, challenge and sign-in scheme, caller-supplied client
assertion and additional parameters. Requests with different parameters
each get their own token.

IUserTokenRequestConcurrencyControl gets an overload that receives the
request parameters. It's a default interface method that forwards to the
original method, so existing implementations keep working unchanged.

Combining different parameters (resource isolation) with one-time-use
refresh tokens is not supported, and the interface documents this.

(cherry picked from commit 83fb6e7)
Refreshes for different parameters can now run concurrently, including
their stores. Within one HTTP request, concurrent StoreTokenAsync calls on
the default authentication-session store raced on the shared
authentication properties (a duplicate-key exception on .TokenNames), the
per-request authenticate cache and the sign-in.

The store now reads, and reads/updates/signs in/caches, one at a time per
request, using a lock in the request-scoped AuthenticateResultCache. Each
store builds on the previous one, so the cookie keeps the tokens for every
resource.

(cherry picked from commit 6856858)
@pgermishuys
pgermishuys force-pushed the pg/atm-4.3-refresh-per-parameters branch from 213df9d to 48e845b Compare October 16, 2026 12:58
@pgermishuys
pgermishuys changed the base branch from releases/atm/4.3.x to releases/atm/4.2.x October 16, 2026 13:09
@pgermishuys
pgermishuys changed the base branch from releases/atm/4.2.x to releases/atm/4.3.x October 16, 2026 13:09
@pgermishuys
pgermishuys merged commit 402358c into releases/atm/4.3.x Oct 16, 2026
2 checks passed
@pgermishuys
pgermishuys deleted the pg/atm-4.3-refresh-per-parameters branch October 16, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/foss/atm Issues related to Access Token Management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants