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
IdTokenExpiry
Gets the expiration date and time for the ID token portion of the currently held access token.
DateTimeOffset? IdTokenExpiry { get; }Property Value
IdTokenSubject
Gets the subject (user identifier) for the ID token portion of the currently held access token.
string? IdTokenSubject { get; }Property Value
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
- cancellationTokenCancellationToken
- 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
- tokenResponseTokenResponse
- 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
- tokenResponseTokenResponse
- The token to store. 
- cancellationTokenCancellationToken
- 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.