Class FileSystemKeyStore
- Namespace
- Fdyay.IdentityServer.Stores
- Assembly
- Fdyay.IdentityServer.Core.dll
Keeps signing keys as files in a directory, one per key: is-signing-key-{id}.json. The default
ISigningKeyStore, at KeyManagementOptions.KeyPath. Duende's FileSystemKeyStore, measured.
public class FileSystemKeyStore : ISigningKeyStore
- Inheritance
-
FileSystemKeyStore
- Implements
- Inherited Members
Remarks
Each file is the SerializedKey as JSON; a file that does not read is logged and skipped, and the store goes on. Until 0.137.0 the default store was in memory, so a restart made a new key and every outstanding token stopped validating. The directory is created when first needed. Several instances may share it: key management converges on one key between them (0.136.0).
Constructors
FileSystemKeyStore(DirectoryInfo, ILogger<FileSystemKeyStore>)
A store over directory, which is created when first needed.
public FileSystemKeyStore(DirectoryInfo directory, ILogger<FileSystemKeyStore> logger)
Parameters
directoryDirectoryInfoThe directory the key files are kept in.
loggerILogger<FileSystemKeyStore>Where a key file that cannot be read or deleted is reported.
Exceptions
- ArgumentNullException
directoryorloggeris null.
FileSystemKeyStore(string, ILogger<FileSystemKeyStore>)
A store over the directory at path, which is created when first needed.
public FileSystemKeyStore(string path, ILogger<FileSystemKeyStore> logger)
Parameters
pathstringThe directory's path.
loggerILogger<FileSystemKeyStore>Where a key file that cannot be read or deleted is reported.
Exceptions
- ArgumentNullException
pathorloggeris null.
Methods
DeleteKeyAsync(string, CancellationToken)
Deletes a key by id.
public Task DeleteKeyAsync(string id, CancellationToken cancellationToken = default)
Parameters
idstringcancellationTokenCancellationToken
Returns
Remarks
A file that cannot be deleted is logged, not thrown.
LoadKeysAsync(CancellationToken)
Loads all persisted keys.
public Task<IEnumerable<SerializedKey>> LoadKeysAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
Remarks
Reads every is-signing-key-*.json file; one that cannot be read or parsed is logged and skipped.
StoreKeyAsync(SerializedKey, CancellationToken)
Persists a key.
public Task StoreKeyAsync(SerializedKey key, CancellationToken cancellationToken = default)
Parameters
keySerializedKeycancellationTokenCancellationToken
Returns
Remarks
Writes is-signing-key-{id}.json, replacing a file of that name.