Interface IDeviceFlowStore
- Namespace
- Fdyay.IdentityServer.Stores
- Assembly
- Fdyay.IdentityServer.Core.dll
Stores pending device authorizations, reachable by device code or by user code.
public interface IDeviceFlowStore
Remarks
Separate from IPersistedGrantStore because that store finds a grant by a single key, and this one has to answer to two: the device polls with one and the user approves with the other.
Methods
FindByDeviceCodeAsync(string, CancellationToken)
The authorization stored under a device code, or null.
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.
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.
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.
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.
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.