22.111. Class AuthenticationCache
Namespace: ArmoniK.Core.Common.Auth.Authentication
Assembly: ArmoniK.Core.Common.dll
Class used to cache the identity of a authenticated user from the request’s headers. This saves precious time by not needing to ask the authentication database
public class AuthenticationCache
22.111.1. Inheritance
22.111.2. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
22.111.3. Constructors
22.111.3.1. AuthenticationCache()
Creates a new authentication cache
public AuthenticationCache()
22.111.4. Methods
22.111.4.1. Clear()
Clears all values from the cache
public void Clear()
22.111.4.2. FlushConnection(string)
Removes all the user identities associated with a connection This is useful to reduce the size of the cache when a connection closes
public void FlushConnection(string connectionId)
22.111.4.2.1. Parameters
connectionId string
Connection id to remove
22.111.4.3. Get(AuthenticationCacheKey)
Get the UserIdentity associated with the given key, null if it doesn’t exist
public virtual ClaimsPrincipal? Get(AuthenticationCacheKey key)
22.111.4.3.1. Parameters
Key obtained from the request header
22.111.4.3.2. Returns
Identity of the user
22.111.4.4. Set(AuthenticationCacheKey, ClaimsPrincipal)
Set the user identity associated with the given key
public void Set(AuthenticationCacheKey key, ClaimsPrincipal identity)
22.111.4.4.1. Parameters
Key obtained from the request header
identity ClaimsPrincipal
User identity obtained thorough