Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When KeyRingProvider
uses an expired key with AutoGenerateKeys = false
, it schedules the next refresh for up to 24 hours in the future:
This creates a problem in multi-application scenarios where:
- App A generates keys
- App B has
AutoGenerateKeys = false
and relies on App A for new keys, but starts few minutes earlier than App A - When App B's key expires, it waits up to 24h before checking for new keys from App A
Since App B explicitly disabled auto-generation, it depends on other apps for new keys and should check for them more frequently when using expired keys (e.g., every 5 minutes).
Suggested fix:
Use a shorter refresh period when defaultKey.ExpirationDate <= now && !_keyManagementOptions.AutoGenerateKeys