Table of Contents

Class KeyGeneratorFromIdentity

Namespace
Arc4u.OAuth2.Security.Principal
Assembly
Arc4u.OAuth2.AspNetCore.dll

This class is intented to be used in a service scenario where multiple users are connected. The claims are cached based on a unique identifier from the claims in an identity.

[Export(typeof(ICacheKeyGenerator))]
[Shared]
public class KeyGeneratorFromIdentity : ICacheKeyGenerator
Inheritance
KeyGeneratorFromIdentity
Implements
Inherited Members

Constructors

KeyGeneratorFromIdentity(IUserObjectIdentifier)

Initializes a new instance of the KeyGeneratorFromIdentity class.

public KeyGeneratorFromIdentity(IUserObjectIdentifier userKeyIdentifier)

Parameters

userKeyIdentifier IUserObjectIdentifier

The service that finds the identifier of a user in an identity.

Exceptions

ArgumentNullException

userKeyIdentifier is null.

Methods

GetClaimsKey(ClaimsIdentity)

Gets the cache key of the identity: the user identifier followed by _ClaimsCache.

public string GetClaimsKey(ClaimsIdentity identity)

Parameters

identity ClaimsIdentity

The identity of the user.

Returns

string

The cache key.

Exceptions

NullReferenceException

No user identifier is found in the identity.