Table of Contents

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

Keys Dictionary<string, DateTime>

The cache keys of the tokens and their expiration date (UTC).

CacheNames Dictionary<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

Dictionary<string, string>

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

DateTime

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

Dictionary<string, DateTime>

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

key string

The cache key of the token.

Returns

string

The name of the cache.