2026-02-08 11:57:57 +01:00
|
|
|
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");
|
|
|
|
|
|
2026-02-15 19:18:02 +01:00
|
|
|
public string GetSecret(string name)
|
2026-02-08 11:57:57 +01:00
|
|
|
{
|
|
|
|
|
return secrets.GetValue<string>(name) ?? "";
|
|
|
|
|
}
|
2026-02-24 06:32:58 +01:00
|
|
|
|
|
|
|
|
public EncryptionKey[] GetKeys(string name)
|
|
|
|
|
{
|
|
|
|
|
return secrets.GetSection(name).Get<EncryptionKey[]>() ?? [];
|
|
|
|
|
}
|
2026-02-08 11:57:57 +01:00
|
|
|
}
|