IUserSecretsManager Methods
Interface Methods 3 members
Defines an interface for managing user secrets with support for read and write operations.
GetOrSetSecret(IConfigurationManager, string, Func<string>) Section titled GetOrSetSecret(IConfigurationManager, string, Func<string>) abstract Gets a secret value if it exists in configuration, or sets it using the value generator if it doesn't.
public interface IUserSecretsManager{ public abstract void GetOrSetSecret( IConfigurationManager configuration, string name, Func<string> valueGenerator) { // ... }}Parameters
configuration IConfigurationManager The configuration manager to check and update. name string The name of the secret. valueGenerator Func<string> Function to generate the value if it doesn't exist. SaveStateAsync(JsonObject, CancellationToken) Section titled SaveStateAsync(JsonObject, CancellationToken) abstract Task Saves state to user secrets asynchronously (for deployment state manager). If multiple callers save state concurrently, the last write wins.
public interface IUserSecretsManager{ public abstract Task SaveStateAsync( JsonObject state, CancellationToken cancellationToken = default(CancellationToken)) { // ... }}Parameters
state JsonObject The state to save as a JSON object. cancellationToken CancellationToken optional Cancellation token. Attempts to set a user secret value synchronously.
public interface IUserSecretsManager{ public abstract bool TrySetSecret( string name, string value) { // ... }}Parameters
name string The name of the secret. value string The value of the secret. Returns
bool True if the secret was set successfully; otherwise, false.