Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Release History

## 1.4.0 (2024-11-26)
## 1.4.0-beta.1 (Unreleased)

### Other Changes
### Features Added

### Breaking Changes

- Updated dependency `Microsoft.Extensions.DependencyInjection` to version `8.0.11`
- Updated dependency `Microsoft.Bcl.AsyncInterfaces` to version `8.0.0`
### Bugs Fixed

### Other Changes

## 1.3.4 (2024-04-16)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
<Description>Microsoft Azure Blob storage support as key store (https://docs.microsoft.com/aspnet/core/security/data-protection/implementation/key-storage-providers).</Description>
<PackageTags>aspnetcore;dataprotection;azure;blob;key store</PackageTags>
<Version>1.4.0</Version>
<Version>1.4.0-beta.1</Version>
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
<ApiCompatVersion>1.3.4</ApiCompatVersion>
<IsExtensionClientLibrary>true</IsExtensionClientLibrary>
Expand All @@ -13,8 +13,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection" VersionOverride="8.0.11" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" VersionOverride="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection" />
<PackageReference Include="Azure.Storage.Blobs" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" VersionOverride="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Moq" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Release History

## 1.3.0 (2024-11-26)
## 1.3.0-beta.1 (Unreleased)

### Other Changes
### Features Added

### Breaking Changes

- Updated dependency `Microsoft.Extensions.DependencyInjection` to version `8.0.11`
- Updated dependency `Microsoft.Bcl.AsyncInterfaces` to version `8.0.0`
### Bugs Fixed

### Other Changes

## 1.2.4 (2024-08-16)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Microsoft Azure Key Vault key encryption support.</Description>
<PackageTags>aspnetcore;dataprotection;azure;keyvault</PackageTags>
<Version>1.3.0</Version>
<Version>1.3.0-beta.1</Version>
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
<ApiCompatVersion>1.2.4</ApiCompatVersion>
<IsExtensionClientLibrary>true</IsExtensionClientLibrary>
Expand All @@ -12,8 +12,7 @@

<ItemGroup>
<PackageReference Include="Azure.Core" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection" VersionOverride="8.0.11" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" VersionOverride="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection" />
<PackageReference Include="Azure.Security.KeyVault.Keys" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
Expand All @@ -9,8 +9,10 @@
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" VersionOverride="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Moq" />

<PackageReference Include="Microsoft.AspNetCore.DataProtection.AzureKeyVault" VersionOverride="3.1.7" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
using Azure.Identity;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.DataProtection.KeyManagement;
using Azure.Security.KeyVault.Keys;
using Microsoft.Azure.KeyVault;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using NUnit.Framework;
using Azure.Core.TestFramework;

namespace Azure.Extensions.AspNetCore.DataProtection.Keys.Tests
{
Expand All @@ -20,7 +19,7 @@ public class AzureDataProtectionBuilderExtensionsTests
public void ProtectKeysWithAzureKeyVault_UsesAzureKeyVaultXmlEncryptor()
{
// Arrange
var client = new KeyClient(new Uri("http://www.example.com/dummyKey"),new MockCredential());
var client = new KeyVaultClient((_, _, _) => Task.FromResult(string.Empty));
var serviceCollection = new ServiceCollection();
var builder = serviceCollection.AddDataProtection();

Expand All @@ -37,7 +36,7 @@ public void ProtectKeysWithAzureKeyVault_UsesAzureKeyVaultXmlEncryptor()
public void ProtectKeysWithAzureKeyVault_WithServiceProviderFunc_UsesAzureKeyVaultXmlEncryptor()
{
// Arrange
var client = new KeyClient(new Uri("http://www.example.com/dummyKey"), new MockCredential());
var client = new KeyVaultClient((_, _, _) => Task.FromResult(string.Empty));
var serviceCollection = new ServiceCollection();
var builder = serviceCollection.AddDataProtection();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using System.Threading.Tasks;
using System.Xml.Linq;
using Azure.Core.TestFramework;
using Azure.Extensions.AspNetCore.DataProtection.Keys.Tests;
using Azure.Identity;
using Azure.Security.KeyVault.Keys;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.DataProtection.KeyManagement;
Expand Down Expand Up @@ -54,7 +56,7 @@ public async Task ProtectsKeysWithKeyVaultKey()
}

[Test]
public async Task CanDecryptEncryptedKeys()
public async Task CanUprotectExistingKeys()
{
var client = new KeyClient(new Uri(TestEnvironment.KeyVaultUrl), TestEnvironment.Credential);
var key = await client.CreateKeyAsync("TestEncryptionKey2", KeyType.Rsa);
Expand All @@ -63,23 +65,32 @@ public async Task CanDecryptEncryptedKeys()

var testKeyRepository = new TestKeyRepository();

// Configure data protection to use TokenCredential
serviceCollection.AddDataProtection()
.ProtectKeysWithAzureKeyVault(key.Value.Id, TestEnvironment.Credential);
AzureDataProtectionBuilderExtensions.ProtectKeysWithAzureKeyVault(
serviceCollection.AddDataProtection(),
key.Value.Id.AbsoluteUri,
TestEnvironment.ClientId,
TestEnvironment.ClientSecret);

serviceCollection.Configure<KeyManagementOptions>(options =>
{
options.XmlRepository = testKeyRepository;
});

var services = serviceCollection.BuildServiceProvider();
var servicesOld = serviceCollection.BuildServiceProvider();

// Encrypt data
var dataProtector = services.GetService<IDataProtectionProvider>().CreateProtector("Fancy purpose");
var serviceCollectionNew = new ServiceCollection();
serviceCollectionNew.AddDataProtection().ProtectKeysWithAzureKeyVault(key.Value.Id, TestEnvironment.Credential);
serviceCollectionNew.Configure<KeyManagementOptions>(options =>
{
options.XmlRepository = testKeyRepository;
});

var dataProtector = servicesOld.GetService<IDataProtectionProvider>().CreateProtector("Fancy purpose");
var protectedText = dataProtector.Protect("Hello world!");

// Decrypt data
var unprotectedText = dataProtector.Unprotect(protectedText);
var newServices = serviceCollectionNew.BuildServiceProvider();
var newDataProtectionProvider = newServices.GetService<IDataProtectionProvider>().CreateProtector("Fancy purpose");
var unprotectedText = newDataProtectionProvider.Unprotect(protectedText);

Assert.AreEqual("Hello world!", unprotectedText);

Expand Down
11 changes: 7 additions & 4 deletions sdk/extensions/Microsoft.Extensions.Azure/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Release History

## 1.9.0 (2024-11-26)
## 1.9.0-beta.1 (Unreleased)

### Other Changes
### Features Added

### Breaking Changes

- Updated dependency `Microsoft.Extensions.DependencyInjection.Abstractions` to version `8.0.2`
- Updated dependency `Microsoft.Bcl.AsyncInterfaces` to version `8.0.0`
### Bugs Fixed

### Other Changes

## 1.8.0 (2024-11-05)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
<Description>Azure Client SDK integration with Microsoft.Extensions libraries</Description>
<AssemblyTitle>Azure Client SDK integration Microsoft.Extensions</AssemblyTitle>
<Version>1.9.0</Version>
<Version>1.9.0-beta.1</Version>
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
<ApiCompatVersion>1.8.0</ApiCompatVersion>
<PackageTags>Microsoft Azure Client Pipeline AspNetCore Extensions</PackageTags>
Expand All @@ -21,11 +21,10 @@
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Core" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" VersionOverride="8.0.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Options" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" VersionOverride="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" VersionOverride="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="System.Net.WebSockets.Client" />
<PackageReference Include="System.ValueTuple" />
Expand Down