Class InMemoryDeviceFlowStore
- Namespace
- Fdyay.IdentityServer.Stores.InMemory
- Assembly
- Fdyay.IdentityServer.Core.dll
In-process device flow store, for a single-instance host.
public sealed class InMemoryDeviceFlowStore : IDeviceFlowStore
- Inheritance
-
InMemoryDeviceFlowStore
- Implements
- Inherited Members
Remarks
A second instance would not see the first's pending authorizations, so a device could poll one instance while the user approved on another and never receive a token. A multi-instance host replaces this.
Methods
FindByDeviceCodeAsync(string, CancellationToken)
The authorization stored under a device code, or null.
public Task<DeviceCode?> FindByDeviceCodeAsync(string deviceCode, CancellationToken cancellationToken = default)
Parameters
deviceCodestringThe device code's key.
cancellationTokenCancellationTokenCancels the read.
Returns
- Task<DeviceCode>
The authorization, or null when none is stored under that key.
FindByUserCodeAsync(string, CancellationToken)
The authorization stored under a user code, or null.
public Task<DeviceCode?> FindByUserCodeAsync(string userCode, CancellationToken cancellationToken = default)
Parameters
userCodestringThe user code's key.
cancellationTokenCancellationTokenCancels the read.
Returns
- Task<DeviceCode>
The authorization, or null when none is stored under that key.
RemoveByDeviceCodeAsync(string, CancellationToken)
Removes the authorization stored under a device code, under both of its keys.
public Task RemoveByDeviceCodeAsync(string deviceCode, CancellationToken cancellationToken = default)
Parameters
deviceCodestringThe device code's key.
cancellationTokenCancellationTokenCancels the removal.
Returns
StoreDeviceAuthorizationAsync(string, string, DeviceCode, CancellationToken)
Stores a new pending authorization under both of its keys.
public Task StoreDeviceAuthorizationAsync(string deviceCode, string userCode, DeviceCode data, CancellationToken cancellationToken = default)
Parameters
deviceCodestringThe device code's key — its hash, as IDeviceFlowCodeService passes it.
userCodestringThe user code's key — its hash, as IDeviceFlowCodeService passes it.
dataDeviceCodeThe authorization.
cancellationTokenCancellationTokenCancels the write.
Returns
UpdateByUserCodeAsync(string, DeviceCode, CancellationToken)
Replaces the authorization stored under a user code, under both of its keys — a user's approval or denial.
public Task UpdateByUserCodeAsync(string userCode, DeviceCode data, CancellationToken cancellationToken = default)
Parameters
userCodestringThe user code's key.
dataDeviceCodeThe authorization as it now stands.
cancellationTokenCancellationTokenCancels the write.
Returns
Remarks
The in-tree stores do nothing when no authorization is stored under userCode.