26.114. 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

26.114.1. Inheritance

objectAuthenticationCache

26.114.2. Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

26.114.3. Constructors

26.114.3.1. AuthenticationCache()

Creates a new authentication cache

public AuthenticationCache()

26.114.4. Methods

26.114.4.1. Clear()

Clears all values from the cache

public void Clear()

26.114.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)

26.114.4.2.1. Parameters

connectionId string

Connection id to remove

26.114.4.3. Get(AuthenticationCacheKey)

Get the UserIdentity associated with the given key, null if it doesn’t exist

public virtual ClaimsPrincipal? Get(AuthenticationCacheKey key)

26.114.4.3.1. Parameters

key AuthenticationCacheKey

Key obtained from the request header

26.114.4.3.2. Returns

ClaimsPrincipal?

Identity of the user

26.114.4.4. Set(AuthenticationCacheKey, ClaimsPrincipal)

Set the user identity associated with the given key

public void Set(AuthenticationCacheKey key, ClaimsPrincipal identity)

26.114.4.4.1. Parameters

key AuthenticationCacheKey

Key obtained from the request header

identity ClaimsPrincipal

User identity obtained thorough