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
grantType
stringType of the grant.
store
IPersistedGrantStoreThe store.
serializer
IPersistentGrantSerializerThe serializer.
handleGenerationService
IHandleGenerationServiceThe handle generation service.
logger
ILoggerThe 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
item
TThe item.
clientId
stringThe client identifier.
subjectId
stringThe subject identifier.
sessionId
stringThe session identifier.
description
stringThe description.
created
DateTimeThe created.
lifetime
intThe lifetime.
Returns
GetAllAsync(PersistedGrantFilter)
Gets the items.
protected virtual Task<IEnumerable<T>> GetAllAsync(PersistedGrantFilter filter)
Parameters
filter
PersistedGrantFilter
Returns
- Task<IEnumerable<T>>
GetHashedKey(string)
Gets the hashed key.
protected virtual string GetHashedKey(string value)
Parameters
value
stringThe value.
Returns
GetItemAsync(string)
Gets the item.
protected virtual Task<T> GetItemAsync(string key)
Parameters
key
stringThe key.
Returns
- Task<T>
GetItemByHashedKeyAsync(string)
Gets the item by the hashed key.
protected virtual Task<T> GetItemByHashedKeyAsync(string hashedKey)
Parameters
hashedKey
string
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
subjectId
stringThe subject identifier.
clientId
stringThe client identifier.
sessionId
stringThe optional session identifier.
Returns
RemoveItemAsync(string)
Removes the item.
protected virtual Task RemoveItemAsync(string key)
Parameters
key
stringThe key.
Returns
RemoveItemByHashedKeyAsync(string)
Removes the item.
protected virtual Task RemoveItemByHashedKeyAsync(string key)
Parameters
key
stringThe 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
key
stringThe key.
item
TThe item.
clientId
stringThe client identifier.
subjectId
stringThe subject identifier.
sessionId
stringThe session identifier.
description
stringThe description.
created
DateTimeThe created time.
expiration
DateTime?The expiration.
consumedTime
DateTime?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
hashedKey
stringThe key.
item
TThe item.
clientId
stringThe client identifier.
subjectId
stringThe subject identifier.
sessionId
stringThe session identifier.
description
stringThe description.
created
DateTimeThe created time.
expiration
DateTime?The expiration.
consumedTime
DateTime?The consumed time.