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

23.109.1. Inheritance

objectAuthenticationCache

23.109.2. Inherited Members

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

23.109.3. Constructors

23.109.3.1. AuthenticationCache()

Creates a new authentication cache

public AuthenticationCache()

23.109.4. Methods

23.109.4.1. Clear()

Clears all values from the cache

public void Clear()

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

23.109.4.2.1. Parameters

connectionId string

Connection id to remove

23.109.4.3. Get(AuthenticationCacheKey)

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

public virtual ClaimsPrincipal? Get(AuthenticationCacheKey key)

23.109.4.3.1. Parameters

key AuthenticationCacheKey

Key obtained from the request header

23.109.4.3.2. Returns

ClaimsPrincipal?

Identity of the user

23.109.4.4. Set(AuthenticationCacheKey, ClaimsPrincipal)

Set the user identity associated with the given key

public void Set(AuthenticationCacheKey key, ClaimsPrincipal identity)

23.109.4.4.1. Parameters

key AuthenticationCacheKey

Key obtained from the request header

identity ClaimsPrincipal

User identity obtained thorough