Table of Contents

Interface IAccessTokenRepository

Namespace
Tenduke.Core.Auth.TokenStore
Assembly
Tenduke.Core.dll

Represents a service for storing and retrieving access tokens for the currently authenticated user.

public interface IAccessTokenRepository : IDisposable
Inherited Members

Remarks

This service is used by the ILoginService implementations intended for use in console or desktop applications. This service is not considered useful for applications with multiple, concurrent users (for example web application or web API scenarios).

Properties

CurrentAccessToken

Gets the current access token.

TokenResponse? CurrentAccessToken { get; }

Property Value

TokenResponse

IdTokenExpiry

Gets the expiration date and time for the ID token portion of the currently held access token.

DateTimeOffset? IdTokenExpiry { get; }

Property Value

DateTimeOffset?

IdTokenSubject

Gets the subject (user identifier) for the ID token portion of the currently held access token.

string? IdTokenSubject { get; }

Property Value

string

Methods

LoadAsync()

Loads the access token from the store.

Task<TokenResponse?> LoadAsync()

Returns

Task<TokenResponse>

The access token, if one exists; otherwise null

LoadAsync(CancellationToken)

Loads the access token from the store.

Task<TokenResponse?> LoadAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task<TokenResponse>

The access token, if one exists; otherwise null

SetNewTokenAsync(TokenResponse?)

Updates the currently held access token (if any) with a new token.

Task SetNewTokenAsync(TokenResponse? tokenResponse)

Parameters

tokenResponse TokenResponse

The token to store.

Returns

Task

A task that can be used to await completion of the operation.

Exceptions

FormatException

Expiry ('exp') claim was not in the expected format.

SetNewTokenAsync(TokenResponse?, CancellationToken)

Updates the currently held access token (if any) with a new token.

Task SetNewTokenAsync(TokenResponse? tokenResponse, CancellationToken cancellationToken)

Parameters

tokenResponse TokenResponse

The token to store.

cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task

A task that can be used to await completion of the operation.

Exceptions

FormatException

Expiry ('exp') claim was not in the expected format.