Skip to content

Commit 1874aeb

Browse files
authored
[Extensions] Update DataProtection dependency to v8.x (Azure#47286)
* Bump Microsoft.AspNetCore.DataProtection to 8.0.11 * Bump Microsoft.Extensions.DependencyInjection to 6.0.2 * Bump Microsoft.Extensions.DependencyInjection.Abstractions to 8.0.2 * Upgrade Microsoft.Extensions.DependencyInjection to 8.0.1 * Remove dependency on Microsoft.AspNetCore.DataProtection.AzureKeyVault * Update CanDecryptEncryptedKeys test * Fix tests using track1 KeyVault SDK * Override version for Microsoft.Bcl.AsyncInterfaces * Override Microsoft.Bcl.AsyncInterfaces to v8.0.0 * Override DependencyInjections and DataProtections versions in Extensions * Revert changes in Packages.Data.Props * Override versions in Microsoft.Extensions.Azure and add AsyncInterfaces back * Update changelogs and project versions
1 parent 2f68503 commit 1874aeb

11 files changed

+38
-56
lines changed

sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Blobs/CHANGELOG.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
# Release History
22

3-
## 1.4.0-beta.1 (Unreleased)
4-
5-
### Features Added
6-
7-
### Breaking Changes
8-
9-
### Bugs Fixed
3+
## 1.4.0 (2024-11-26)
104

115
### Other Changes
126

7+
- Updated dependency `Microsoft.Extensions.DependencyInjection` to version `8.0.11`
8+
- Updated dependency `Microsoft.Bcl.AsyncInterfaces` to version `8.0.0`
9+
1310
## 1.3.4 (2024-04-16)
1411

1512
### Bugs Fixed

sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Blobs/src/Azure.Extensions.AspNetCore.DataProtection.Blobs.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
55
<Description>Microsoft Azure Blob storage support as key store (https://docs.microsoft.com/aspnet/core/security/data-protection/implementation/key-storage-providers).</Description>
66
<PackageTags>aspnetcore;dataprotection;azure;blob;key store</PackageTags>
7-
<Version>1.4.0-beta.1</Version>
7+
<Version>1.4.0</Version>
88
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
99
<ApiCompatVersion>1.3.4</ApiCompatVersion>
1010
<IsExtensionClientLibrary>true</IsExtensionClientLibrary>
@@ -13,7 +13,8 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Azure.Core" />
16-
<PackageReference Include="Microsoft.AspNetCore.DataProtection" />
16+
<PackageReference Include="Microsoft.AspNetCore.DataProtection" VersionOverride="8.0.11" />
17+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" VersionOverride="8.0.0" />
1718
<PackageReference Include="Azure.Storage.Blobs" />
1819
</ItemGroup>
1920

sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Blobs/tests/Azure.Extensions.AspNetCore.DataProtection.Blobs.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<PackageReference Include="NUnit" />
1010
<PackageReference Include="NUnit3TestAdapter" />
1111
<PackageReference Include="Microsoft.NET.Test.Sdk" />
12-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
12+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" VersionOverride="8.0.1" />
1313
<PackageReference Include="Moq" />
1414
</ItemGroup>
1515

sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Keys/CHANGELOG.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
# Release History
22

3-
## 1.3.0-beta.1 (Unreleased)
4-
5-
### Features Added
6-
7-
### Breaking Changes
8-
9-
### Bugs Fixed
3+
## 1.3.0 (2024-11-26)
104

115
### Other Changes
126

7+
- Updated dependency `Microsoft.Extensions.DependencyInjection` to version `8.0.11`
8+
- Updated dependency `Microsoft.Bcl.AsyncInterfaces` to version `8.0.0`
9+
1310
## 1.2.4 (2024-08-16)
1411

1512
### Other Changes

sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Keys/src/Azure.Extensions.AspNetCore.DataProtection.Keys.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<Description>Microsoft Azure Key Vault key encryption support.</Description>
55
<PackageTags>aspnetcore;dataprotection;azure;keyvault</PackageTags>
6-
<Version>1.3.0-beta.1</Version>
6+
<Version>1.3.0</Version>
77
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
88
<ApiCompatVersion>1.2.4</ApiCompatVersion>
99
<IsExtensionClientLibrary>true</IsExtensionClientLibrary>
@@ -12,7 +12,8 @@
1212

1313
<ItemGroup>
1414
<PackageReference Include="Azure.Core" />
15-
<PackageReference Include="Microsoft.AspNetCore.DataProtection" />
15+
<PackageReference Include="Microsoft.AspNetCore.DataProtection" VersionOverride="8.0.11" />
16+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" VersionOverride="8.0.0" />
1617
<PackageReference Include="Azure.Security.KeyVault.Keys" />
1718
</ItemGroup>
1819

sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Keys/tests/Azure.Extensions.AspNetCore.DataProtection.Keys.Tests.csproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
@@ -9,10 +9,8 @@
99
<PackageReference Include="NUnit" />
1010
<PackageReference Include="NUnit3TestAdapter" />
1111
<PackageReference Include="Microsoft.NET.Test.Sdk" />
12-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
12+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" VersionOverride="8.0.1" />
1313
<PackageReference Include="Moq" />
14-
15-
<PackageReference Include="Microsoft.AspNetCore.DataProtection.AzureKeyVault" VersionOverride="3.1.7" />
1614
</ItemGroup>
1715

1816
<ItemGroup>

sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Keys/tests/AzureDataProtectionBuilderExtensionsTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
using Azure.Identity;
77
using Microsoft.AspNetCore.DataProtection;
88
using Microsoft.AspNetCore.DataProtection.KeyManagement;
9-
using Microsoft.Azure.KeyVault;
9+
using Azure.Security.KeyVault.Keys;
1010
using Microsoft.Extensions.DependencyInjection;
1111
using Microsoft.Extensions.Options;
1212
using NUnit.Framework;
13+
using Azure.Core.TestFramework;
1314

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

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

sdk/extensions/Azure.Extensions.AspNetCore.DataProtection.Keys/tests/DataProtectionKeysFunctionalTests.cs

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
using System.Threading.Tasks;
77
using System.Xml.Linq;
88
using Azure.Core.TestFramework;
9-
using Azure.Extensions.AspNetCore.DataProtection.Keys.Tests;
10-
using Azure.Identity;
119
using Azure.Security.KeyVault.Keys;
1210
using Microsoft.AspNetCore.DataProtection;
1311
using Microsoft.AspNetCore.DataProtection.KeyManagement;
@@ -56,7 +54,7 @@ public async Task ProtectsKeysWithKeyVaultKey()
5654
}
5755

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

6664
var testKeyRepository = new TestKeyRepository();
6765

68-
AzureDataProtectionBuilderExtensions.ProtectKeysWithAzureKeyVault(
69-
serviceCollection.AddDataProtection(),
70-
key.Value.Id.AbsoluteUri,
71-
TestEnvironment.ClientId,
72-
TestEnvironment.ClientSecret);
66+
// Configure data protection to use TokenCredential
67+
serviceCollection.AddDataProtection()
68+
.ProtectKeysWithAzureKeyVault(key.Value.Id, TestEnvironment.Credential);
7369

7470
serviceCollection.Configure<KeyManagementOptions>(options =>
7571
{
7672
options.XmlRepository = testKeyRepository;
7773
});
7874

79-
var servicesOld = serviceCollection.BuildServiceProvider();
80-
81-
var serviceCollectionNew = new ServiceCollection();
82-
serviceCollectionNew.AddDataProtection().ProtectKeysWithAzureKeyVault(key.Value.Id, TestEnvironment.Credential);
83-
serviceCollectionNew.Configure<KeyManagementOptions>(options =>
84-
{
85-
options.XmlRepository = testKeyRepository;
86-
});
75+
var services = serviceCollection.BuildServiceProvider();
8776

88-
var dataProtector = servicesOld.GetService<IDataProtectionProvider>().CreateProtector("Fancy purpose");
77+
// Encrypt data
78+
var dataProtector = services.GetService<IDataProtectionProvider>().CreateProtector("Fancy purpose");
8979
var protectedText = dataProtector.Protect("Hello world!");
9080

91-
var newServices = serviceCollectionNew.BuildServiceProvider();
92-
var newDataProtectionProvider = newServices.GetService<IDataProtectionProvider>().CreateProtector("Fancy purpose");
93-
var unprotectedText = newDataProtectionProvider.Unprotect(protectedText);
81+
// Decrypt data
82+
var unprotectedText = dataProtector.Unprotect(protectedText);
9483

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

sdk/extensions/Microsoft.Extensions.Azure/CHANGELOG.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
# Release History
22

3-
## 1.9.0-beta.1 (Unreleased)
4-
5-
### Features Added
6-
7-
### Breaking Changes
8-
9-
### Bugs Fixed
3+
## 1.9.0 (2024-11-26)
104

115
### Other Changes
126

7+
- Updated dependency `Microsoft.Extensions.DependencyInjection.Abstractions` to version `8.0.2`
8+
- Updated dependency `Microsoft.Bcl.AsyncInterfaces` to version `8.0.0`
9+
1310
## 1.8.0 (2024-11-05)
1411

1512
### Features Added

sdk/extensions/Microsoft.Extensions.Azure/src/Microsoft.Extensions.Azure.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
55
<Description>Azure Client SDK integration with Microsoft.Extensions libraries</Description>
66
<AssemblyTitle>Azure Client SDK integration Microsoft.Extensions</AssemblyTitle>
7-
<Version>1.9.0-beta.1</Version>
7+
<Version>1.9.0</Version>
88
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
99
<ApiCompatVersion>1.8.0</ApiCompatVersion>
1010
<PackageTags>Microsoft Azure Client Pipeline AspNetCore Extensions</PackageTags>
@@ -21,10 +21,11 @@
2121
<PackageReference Include="Azure.Identity" />
2222
<PackageReference Include="Azure.Core" />
2323
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
24-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
24+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" VersionOverride="8.0.2" />
2525
<PackageReference Include="Microsoft.Extensions.Options" />
2626
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" />
2727
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" />
28+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" VersionOverride="8.0.0" />
2829
</ItemGroup>
2930

3031
<ItemGroup>

0 commit comments

Comments
 (0)