Class OboTokenCacheIndex
- Namespace
- Arc4u.OAuth2.TokenProviders
- Assembly
- Arc4u.OAuth2.AspNetCore.Authentication.dll
The cache keys of the on-behalf-of tokens obtained for one user, with their expiration, stored by AzureADOboTokenProvider so they can be removed when the user signs out.
When the cache serializer uses a JsonSerializerContext, add this type to it.
public record OboTokenCacheIndex : IEquatable<OboTokenCacheIndex>
- Inheritance
-
OboTokenCacheIndex
- Implements
- Inherited Members
Constructors
OboTokenCacheIndex(Dictionary<string, DateTime>, Dictionary<string, string>?)
The cache keys of the on-behalf-of tokens obtained for one user, with their expiration, stored by AzureADOboTokenProvider so they can be removed when the user signs out.
When the cache serializer uses a JsonSerializerContext, add this type to it.
public OboTokenCacheIndex(Dictionary<string, DateTime> Keys, Dictionary<string, string>? CacheNames = null)
Parameters
KeysDictionary<string, DateTime>The cache keys of the tokens and their expiration date (UTC).
CacheNamesDictionary<string, string>The name of the cache of the tokens stored in a named cache (see CacheName), by cache key. A key that is not in it is in the token cache (the cache of the default TokenCacheOptions); an index stored by a previous version has none. The index itself is always in the token cache. The cache name is kept rather than the name of the options, so a token is still found at sign-out when its options are changed or removed.
Properties
CacheNames
The name of the cache of the tokens stored in a named cache (see CacheName), by cache key. A key that is not in it is in the token cache (the cache of the default TokenCacheOptions); an index stored by a previous version has none. The index itself is always in the token cache. The cache name is kept rather than the name of the options, so a token is still found at sign-out when its options are changed or removed.
public Dictionary<string, string>? CacheNames { get; init; }
Property Value
ExpiresOnUtc
Gets the expiration of the last token: the index is kept until then. An empty index is already expired.
[JsonIgnore]
public DateTime ExpiresOnUtc { get; }
Property Value
Remarks
It is computed from Keys, so it is not stored in the cache.
Keys
The cache keys of the tokens and their expiration date (UTC).
public Dictionary<string, DateTime> Keys { get; init; }
Property Value
Methods
GetCacheName(string)
Gets the name of the cache of a cached token, or null for the token cache.
public string? GetCacheName(string key)
Parameters
keystringThe cache key of the token.
Returns
- string
The name of the cache.