22 lines
No EOL
644 B
C#
22 lines
No EOL
644 B
C#
using IdentityShroud.Core.Contracts;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
namespace IdentityShroud.Core.Security;
|
|
|
|
/// <summary>
|
|
/// Secret provider that retrieves secrets from configuration.
|
|
/// </summary>
|
|
public class ConfigurationSecretProvider(IConfiguration configuration) : ISecretProvider
|
|
{
|
|
private readonly IConfigurationSection secrets = configuration.GetSection("secrets");
|
|
|
|
public string GetSecret(string name)
|
|
{
|
|
return secrets.GetValue<string>(name) ?? "";
|
|
}
|
|
|
|
public KeyEncryptionKey[] GetKeys(string name)
|
|
{
|
|
return secrets.GetSection(name).Get<KeyEncryptionKey[]>() ?? [];
|
|
}
|
|
} |