21.115. 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
21.115.1. Inheritance
21.115.2. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
21.115.3. Constructors
21.115.3.1. AuthenticationCache()
Creates a new authentication cache
public AuthenticationCache()
21.115.4. Methods
21.115.4.1. Clear()
Clears all values from the cache
public void Clear()
21.115.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)
21.115.4.2.1. Parameters
connectionId string
Connection id to remove
21.115.4.3. Get(AuthenticationCacheKey)
Get the UserIdentity associated with the given key, null if it doesn’t exist
public virtual ClaimsPrincipal? Get(AuthenticationCacheKey key)
21.115.4.3.1. Parameters
Key obtained from the request header
21.115.4.3.2. Returns
Identity of the user
21.115.4.4. Set(AuthenticationCacheKey, ClaimsPrincipal)
Set the user identity associated with the given key
public void Set(AuthenticationCacheKey key, ClaimsPrincipal identity)
21.115.4.4.1. Parameters
Key obtained from the request header
identity ClaimsPrincipal
User identity obtained thorough