Skip to content

Set size for cached client secrets in DefaultAppleClientSecretGenerator#1191

Open
yasmoradi wants to merge 2 commits into
aspnet-contrib:devfrom
yasmoradi:1190
Open

Set size for cached client secrets in DefaultAppleClientSecretGenerator#1191
yasmoradi wants to merge 2 commits into
aspnet-contrib:devfrom
yasmoradi:1190

Conversation

@yasmoradi

Copy link
Copy Markdown

This PR ensures that the MemoryCache entry created for the Apple client secret has a defined Size.

Motivation

When a developer configures IMemoryCache with a SizeLimit (e.g., services.AddMemoryCache(options => options.SizeLimit = 1024)), all cache entries must have a Size specified. Currently, DefaultAppleClientSecretGenerator does not set this value, which causes the cache to throw an exception.

By setting entry.Size = 1, we ensure compatibility with memory-constrained configurations and prevent potential GC pressure or performance degradation.

Related Issue

Fixes #1190

…nerator

Specifying a size is required when IMemoryCache is configured with a SizeLimit (aspnet-contrib#1190)
@yasmoradi yasmoradi changed the title fix: set size for cached client secrets in DefaultAppleClientSecretGenerator Set size for cached client secrets in DefaultAppleClientSecretGenerator Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

AspNet.Security.OAuth.Apple doesn't set cache entry's size

1 participant