![]() |
VOOZH | about |
dotnet add package Eaf.KeyVault --version 9.1.0
NuGet\Install-Package Eaf.KeyVault -Version 9.1.0
<PackageReference Include="Eaf.KeyVault" Version="9.1.0" />
<PackageVersion Include="Eaf.KeyVault" Version="9.1.0" />Directory.Packages.props
<PackageReference Include="Eaf.KeyVault" />Project file
paket add Eaf.KeyVault --version 9.1.0
#r "nuget: Eaf.KeyVault, 9.1.0"
#:package Eaf.KeyVault@9.1.0
#addin nuget:?package=Eaf.KeyVault&version=9.1.0Install as a Cake Addin
#tool nuget:?package=Eaf.KeyVault&version=9.1.0Install as a Cake Tool
O Eaf.KeyVault é um módulo de gerenciamento de segredos do Enterprise Application Foundation (EAF). Este módulo fornece integração com Azure Key Vault e Oracle Cloud Infrastructure (OCI) para armazenamento seguro de credenciais, chaves de API, strings de conexão e outros segredos sensíveis.
Este módulo abstrai a complexidade de acessar serviços de gerenciamento de segredos, fornecendo uma interface unificada que suporta múltiplos provedores de nuvem.
Interface principal para gerenciamento de segredos, fornecendo métodos para:
Implementação concreta que suporta:
Integração com ASP.NET Core Hosting para:
dotnet add package Eaf.KeyVault --version 10.4.0
Adicione a referência ao seu arquivo .csproj:
<ProjectReference Include="..\Eaf.KeyVault\Eaf.KeyVault.csproj" />
No seu módulo principal, herde de EafKeyVaultModule:
[DependsOn(
typeof(EafKeyVaultModule),
typeof(AbpModule)
)]
public class MyApplicationModule : AbpModule
{
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
}
}
No appsettings.json:
{
"KeyVault": {
"Provider": "Azure",
"Azure": {
"VaultName": "my-vault-name",
"TenantId": "your-tenant-id",
"ClientId": "your-client-id",
"ClientSecret": "your-client-secret"
}
}
}
No appsettings.json:
{
"KeyVault": {
"Provider": "OCI",
"OCI": {
"VaultId": "ocid1.vault.oc1...",
"Region": "us-ashburn-1",
"TenancyId": "ocid1.tenancy.oc1...",
"UserId": "ocid1.user.oc1...",
"Fingerprint": "your-fingerprint",
"PrivateKeyFilePath": "path/to/private_key.pem",
"PrivateKeyPassphrase": "your-passphrase"
}
}
}
public class MyService : ApplicationService
{
private readonly IKeyVaultSecretManager _keyVaultManager;
public MyService(IKeyVaultSecretManager keyVaultManager)
{
_keyVaultManager = keyVaultManager;
}
public async Task<string> GetSecretAsync(string secretName)
{
var secret = await _keyVaultManager.GetSecretAsync(secretName);
return secret.Value;
}
public async Task SetSecretAsync(string secretName, string secretValue)
{
await _keyVaultManager.SetSecretAsync(secretName, secretValue);
}
}
public class Startup
{
public IConfiguration Configuration { get; }
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public void ConfigureServices(IServiceCollection services)
{
// Adiciona KeyVault como fonte de configuração
var keyVaultManager = services.BuildServiceProvider()
.GetRequiredService<IKeyVaultSecretManager>();
ConfigurationBuilder builder = new ConfigurationBuilder();
builder.AddAzureKeyVault(keyVaultManager);
}
}
Eaf.KeyVault/
├── Hosting/ # Integração com ASP.NET Core Hosting
├── KeyVault/ # Implementações específicas do KeyVault
├── IKeyVaultSecretManager.cs # Interface principal
├── KeyVaultSecretManager.cs # Implementação concreta
└── EafKeyVaultModule.cs # Módulo ABP
public override void PreInitialize()
{
Configuration.Modules.EafKeyVault().EnableCache = true;
Configuration.Modules.EafKeyVault().CacheDuration = TimeSpan.FromMinutes(30);
}
public override void PreInitialize()
{
Configuration.Modules.EafKeyVault().EnableRetries = true;
Configuration.Modules.EafKeyVault().MaxRetries = 3;
Configuration.Modules.EafKeyVault().RetryDelay = TimeSpan.FromSeconds(2);
}
Os testes para este módulo estão localizados em:
test/Eaf.KeyVault.Tests/
Para executar os testes:
dotnet test test/Eaf.KeyVault.Tests/Eaf.KeyVault.Tests.csproj
Este projeto faz parte do Enterprise Application Foundation (EAF) e está licenciado sob os mesmos termos do projeto principal.
Para issues e perguntas, consulte o repositório principal do EAF: https://github.com/afonsoft/EAF
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on Eaf.KeyVault:
| Package | Downloads |
|---|---|
|
Eaf.KeyVault.AspNetCore
Enterprise Application Foundation - KeyVault AspNetCore Azure or OCI |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 9.1.0 | 83 | 6/17/2026 |