Repository navigation
Include per-client cache settings for client credentials tokens in ATM 4.3.x - #373
Merged
Merged
Conversation
Erwinvandervalk
approved these changes
Oct 16, 2026
Client credentials token caching was configured only through the global ClientCredentialsTokenManagementOptions, so every client shared the same auto-tuning, default lifetime, lifetime buffer and local cache expiration. Apps that call several authorization servers could not tune these per server. Add ClientCredentialsClientCacheOptions, configured as named options keyed by client name via the new ConfigureClientCache builder method or services.Configure<ClientCredentialsClientCacheOptions>(name, ...). Each property is nullable and falls back to the global option when not set, so existing configurations behave as before. The token manager resolves the effective settings once per request and uses them for the auto-tuning store, the local cache expiration and the expired-token buffer check, so the cache lifetime and the expiry check always agree. The options type has no validator and is independent of ClientCredentialsClient, so overrides also work for clients served by a custom IClientCredentialsTokenEndpoint without AddClient. (cherry picked from commit 82d44af)
pgermishuys
force-pushed
the
pg/atm-4.3-client-cache
branch
from
October 16, 2026 12:58
c928ae8 to
3decfb8
Compare
pgermishuys
changed the base branch from
releases/atm/4.3.x
to
releases/atm/4.2.x
October 16, 2026 13:09
pgermishuys
changed the base branch from
releases/atm/4.2.x
to
releases/atm/4.3.x
October 16, 2026 13:10
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.
Brings #368 to 4.3.x. Apps that use client credentials against more than one authorization server can now set cache auto-tuning, default cache lifetime, lifetime buffer and local cache expiration per client, with
ConfigureClientCacheandClientCredentialsClientCacheOptions. Anything left unset falls back toClientCredentialsTokenManagementOptions, so existing setups behave the same.Cherry-picked the squash commit of #368 with
git cherry-pick -x. One conflict, inClientCredentialsTokenManager.cs: on main the cache log call also takes the token expiration, which comes from #364 and isn't part of 4.3.x. I kept #368'sSetExpiration(cacheKey, token.Expiration, cacheSettings)and the three-argumentCachingAccessTokencall this branch already has.Merge order: last of five, after #372. Until the earlier ones merge, this PR also shows their commits.