| | | 1 | | namespace ArturRios.Util.WebApi.Security.Providers; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Options for <see cref="CachedAuthenticationProvider"/>. |
| | | 5 | | /// </summary> |
| | | 6 | | public class CachedAuthenticationProviderOptions |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// How long a resolved user stays cached before the underlying provider is queried again. |
| | | 10 | | /// Defaults to 60 seconds. Keep it short so role changes and revocations surface quickly. |
| | | 11 | | /// </summary> |
| | 18 | 12 | | public TimeSpan Ttl { get; set; } = TimeSpan.FromSeconds(60); |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// When <see langword="true"/>, "user not found" results are also cached for <see cref="Ttl"/> |
| | | 16 | | /// (negative caching), shielding the store from repeated lookups of unknown ids. Defaults to <see langword="false"/ |
| | | 17 | | /// </summary> |
| | 6 | 18 | | public bool CacheMisses { get; set; } |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// The prefix used to build the cache key for each user id. Defaults to <c>auth:user:</c>. |
| | | 22 | | /// </summary> |
| | 19 | 23 | | public string CacheKeyPrefix { get; set; } = "auth:user:"; |
| | | 24 | | |
| | | 25 | | /// <summary>The prefix used to build the cache key for each user email. Defaults to <c>auth:email:</c>.</summary> |
| | 13 | 26 | | public string EmailCacheKeyPrefix { get; set; } = "auth:email:"; |
| | | 27 | | } |