Table of Contents

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 string

Type of the grant.

store IPersistedGrantStore

The store.

serializer IPersistentGrantSerializer

The serializer.

handleGenerationService IHandleGenerationService

The handle generation service.

logger ILogger

The 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

string

Properties

GrantType

The grant type being stored.

protected string GrantType { get; }

Property Value

string

HandleGenerationService

The HandleGenerationService.

protected IHandleGenerationService HandleGenerationService { get; }

Property Value

IHandleGenerationService

Logger

The logger.

protected ILogger Logger { get; }

Property Value

ILogger

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

Task<string>

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 T

The item.

clientId string

The client identifier.

subjectId string

The subject identifier.

sessionId string

The session identifier.

description string

The description.

created DateTime

The created.

lifetime int

The lifetime.

Returns

Task<string>

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 string

The value.

Returns

string

GetItemAsync(string)

Gets the item.

protected virtual Task<T> GetItemAsync(string key)

Parameters

key string

The 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 string

The subject identifier.

clientId string

The client identifier.

sessionId string

The optional session identifier.

Returns

Task

RemoveItemAsync(string)

Removes the item.

protected virtual Task RemoveItemAsync(string key)

Parameters

key string

The key.

Returns

Task

RemoveItemByHashedKeyAsync(string)

Removes the item.

protected virtual Task RemoveItemByHashedKeyAsync(string key)

Parameters

key string

The key.

Returns

Task

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 string

The key.

item T

The item.

clientId string

The client identifier.

subjectId string

The subject identifier.

sessionId string

The session identifier.

description string

The description.

created DateTime

The created time.

expiration DateTime?

The expiration.

consumedTime DateTime?

The consumed time.

Returns

Task

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 string

The key.

item T

The item.

clientId string

The client identifier.

subjectId string

The subject identifier.

sessionId string

The session identifier.

description string

The description.

created DateTime

The created time.

expiration DateTime?

The expiration.

consumedTime DateTime?

The consumed time.

Returns

Task