Table of Contents

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

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.

public 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.

public 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.

public 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.

public 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.