Class KeyGeneratorFromIdentity
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
userKeyIdentifierIUserObjectIdentifierThe service that finds the identifier of a user in an identity.
Exceptions
- ArgumentNullException
userKeyIdentifieris null.
Methods
GetClaimsKey(ClaimsIdentity)
Gets the cache key of the identity: the user identifier followed by _ClaimsCache.
public string GetClaimsKey(ClaimsIdentity identity)
Parameters
identityClaimsIdentityThe identity of the user.
Returns
- string
The cache key.
Exceptions
- NullReferenceException
No user identifier is found in the identity.