Table of Contents

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

deviceCode string

The device code's key.

cancellationToken CancellationToken

Cancels 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

userCode string

The user code's key.

cancellationToken CancellationToken

Cancels 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

deviceCode string

The device code's key.

cancellationToken CancellationToken

Cancels the removal.

Returns

Task

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

deviceCode string

The device code's key — its hash, as IDeviceFlowCodeService passes it.

userCode string

The user code's key — its hash, as IDeviceFlowCodeService passes it.

data DeviceCode

The authorization.

cancellationToken CancellationToken

Cancels the write.

Returns

Task

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

userCode string

The user code's key.

data DeviceCode

The authorization as it now stands.

cancellationToken CancellationToken

Cancels the write.

Returns

Task

Remarks

The in-tree stores do nothing when no authorization is stored under userCode.