Class DefaultGrantStore<T>
- Namespace
- Duende.IdentityServer.Stores
- Assembly
- Duende.IdentityServer.dll
Base class for persisting grants using the IPersistedGrantStore.
public class DefaultGrantStore<T>
Type Parameters
T
- Inheritance
-
DefaultGrantStore<T>
- Derived
- Inherited Members
Constructors
DefaultGrantStore(string, IPersistedGrantStore, IPersistentGrantSerializer, IHandleGenerationService, ILogger)
Initializes a new instance of the DefaultGrantStore<T> class.
protected DefaultGrantStore(string grantType, IPersistedGrantStore store, IPersistentGrantSerializer serializer, IHandleGenerationService handleGenerationService, ILogger logger)
Parameters
grantTypestringType of the grant.
storeIPersistedGrantStoreThe store.
serializerIPersistentGrantSerializerThe serializer.
handleGenerationServiceIHandleGenerationServiceThe handle generation service.
loggerILoggerThe logger.
Exceptions
- ArgumentNullException
grantType
Fields
HexEncodingFormatSuffix
The suffix added to keys to indicate that hex encoding should be used.
protected const string HexEncodingFormatSuffix = "-1"
Field Value
Properties
GrantType
The grant type being stored.
protected string GrantType { get; }
Property Value
HandleGenerationService
The HandleGenerationService.
protected IHandleGenerationService HandleGenerationService { get; }
Property Value
Logger
The logger.
protected ILogger Logger { get; }
Property Value
Serializer
The PersistentGrantSerializer;
protected IPersistentGrantSerializer Serializer { get; }
Property Value
- IPersistentGrantSerializer
Store
The PersistedGrantStore.
protected IPersistedGrantStore Store { get; }
Property Value
- IPersistedGrantStore
Methods
CreateHandleAsync()
Creates a handle.
protected Task<string> CreateHandleAsync()
Returns
CreateItemAsync(T, string, string, string, string, DateTime, int)
Creates the item.
protected virtual Task<string> CreateItemAsync(T item, string clientId, string subjectId, string sessionId, string description, DateTime created, int lifetime)
Parameters
itemTThe item.
clientIdstringThe client identifier.
subjectIdstringThe subject identifier.
sessionIdstringThe session identifier.
descriptionstringThe description.
createdDateTimeThe created.
lifetimeintThe lifetime.
Returns
GetAllAsync(PersistedGrantFilter)
Gets the items.
protected virtual Task<IEnumerable<T>> GetAllAsync(PersistedGrantFilter filter)
Parameters
filterPersistedGrantFilter
Returns
- Task<IEnumerable<T>>
GetHashedKey(string)
Gets the hashed key.
protected virtual string GetHashedKey(string value)
Parameters
valuestringThe value.
Returns
GetItemAsync(string)
Gets the item.
protected virtual Task<T> GetItemAsync(string key)
Parameters
keystringThe key.
Returns
- Task<T>
GetItemByHashedKeyAsync(string)
Gets the item by the hashed key.
protected virtual Task<T> GetItemByHashedKeyAsync(string hashedKey)
Parameters
hashedKeystring
Returns
- Task<T>
RemoveAllAsync(string, string, string)
Removes all items for a subject id / client id combination.
protected virtual Task RemoveAllAsync(string subjectId, string clientId, string sessionId = null)
Parameters
subjectIdstringThe subject identifier.
clientIdstringThe client identifier.
sessionIdstringThe optional session identifier.
Returns
RemoveItemAsync(string)
Removes the item.
protected virtual Task RemoveItemAsync(string key)
Parameters
keystringThe key.
Returns
RemoveItemByHashedKeyAsync(string)
Removes the item.
protected virtual Task RemoveItemByHashedKeyAsync(string key)
Parameters
keystringThe key.
Returns
StoreItemAsync(string, T, string, string, string, string, DateTime, DateTime?, DateTime?)
Stores the item.
protected virtual Task StoreItemAsync(string key, T item, string clientId, string subjectId, string sessionId, string description, DateTime created, DateTime? expiration, DateTime? consumedTime = null)
Parameters
keystringThe key.
itemTThe item.
clientIdstringThe client identifier.
subjectIdstringThe subject identifier.
sessionIdstringThe session identifier.
descriptionstringThe description.
createdDateTimeThe created time.
expirationDateTime?The expiration.
consumedTimeDateTime?The consumed time.
Returns
StoreItemByHashedKeyAsync(string, T, string, string, string, string, DateTime, DateTime?, DateTime?)
Stores the item.
protected virtual Task StoreItemByHashedKeyAsync(string hashedKey, T item, string clientId, string subjectId, string sessionId, string description, DateTime created, DateTime? expiration, DateTime? consumedTime = null)
Parameters
hashedKeystringThe key.
itemTThe item.
clientIdstringThe client identifier.
subjectIdstringThe subject identifier.
sessionIdstringThe session identifier.
descriptionstringThe description.
createdDateTimeThe created time.
expirationDateTime?The expiration.
consumedTimeDateTime?The consumed time.