Overview
Implement a IKeyVaultService abstraction and its concrete implementation wrapping Azure.Security.KeyVault.Secrets.SecretClient. This service will be consumed by LinkedInAuthService and LinkedInTokenRefresherFunction and is designed to be mockable in unit tests.
Depends on: #54
Tasks
public interface IKeyVaultService
{
Task<string> GetSecretAsync(string secretName);
Task SetSecretAsync(string secretName, string value);
}
builder.Services.AddSingleton<IKeyVaultService, KeyVaultService>();
Acceptance Criteria
References
Overview
Implement a
IKeyVaultServiceabstraction and its concrete implementation wrappingAzure.Security.KeyVault.Secrets.SecretClient. This service will be consumed byLinkedInAuthServiceandLinkedInTokenRefresherFunctionand is designed to be mockable in unit tests.Depends on: #54
Tasks
src/XPoster.csproj:Azure.Security.KeyVault.SecretsAzure.Identitysrc/Abstraction/IKeyVaultService.cs:src/Services/KeyVaultService.csusingDefaultAzureCredential(works both locally withaz loginand in Azure with Managed Identity)Program.csas Singleton:IKeyVaultServiceintests/XPoster.Tests/Services/KeyVaultServiceTests.csAcceptance Criteria
IKeyVaultServiceis fully mockableaz login(no hardcoded credentials)References