Skip to content

FileCredentialStore

Namespace: E2E.OAuth

public sealed class FileCredentialStore : ICredentialStore

One JSON file keyed by provider id, mode 0600. Writes hold an advisory lock and replace the file atomically, so two runs refreshing at once neither tear the file nor lose each other’s entries. Entries this store does not understand are kept as they are.

Inheritance: object

Implements: ICredentialStore

View source

public FileCredentialStore(string path)

Parameters

Name Type Description
path string

View source

public string FilePath { get; }

Value: string

View source

public Task<OAuthCredentials?> GetAsync(string providerId, CancellationToken cancellationToken = default)

Parameters

Name Type Description
providerId string
cancellationToken CancellationToken

Returns: Task<OAuthCredentials>

View source

public Task<IReadOnlyList<string>> ListAsync(CancellationToken cancellationToken = default)

Every provider id with stored credentials.

Parameters

Name Type Description
cancellationToken CancellationToken

Returns: Task<IReadOnlyList<string>>

View source

public Task<bool> RemoveAsync(string providerId, CancellationToken cancellationToken = default)

Forgets the login. True when one was stored.

Parameters

Name Type Description
providerId string
cancellationToken CancellationToken

Returns: Task<bool>

View source

SetAsync(string, OAuthCredentials, CancellationToken)

Section titled “SetAsync(string, OAuthCredentials, CancellationToken)”
public Task SetAsync(string providerId, OAuthCredentials credentials, CancellationToken cancellationToken = default)

Parameters

Name Type Description
providerId string
credentials OAuthCredentials
cancellationToken CancellationToken

Returns: Task

View source