Skip to content

Commit 3f1a379

Browse files
committed
Revert "[Extensions] Update DataProtection dependency to v8.x (Azure#47286)"
This reverts commit 1874aeb.
1 parent da290fa commit 3f1a379

11 files changed

+56
-38
lines changed

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

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

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

5-
### Other Changes
5+
### Features Added
6+
7+
### Breaking Changes
68

7-
- Updated dependency `Microsoft.Extensions.DependencyInjection` to version `8.0.11`
8-
- Updated dependency `Microsoft.Bcl.AsyncInterfaces` to version `8.0.0`
9+
### Bugs Fixed
10+
11+
### Other Changes
912

1013
## 1.3.4 (2024-04-16)
1114

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

Lines changed: 2 additions & 3 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</Version>
7+
<Version>1.4.0-beta.1</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,8 +13,7 @@
1313

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

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" VersionOverride="8.0.1" />
12+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
1313
<PackageReference Include="Moq" />
1414
</ItemGroup>
1515

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

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

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

5-
### Other Changes
5+
### Features Added
6+
7+
### Breaking Changes
68

7-
- Updated dependency `Microsoft.Extensions.DependencyInjection` to version `8.0.11`
8-
- Updated dependency `Microsoft.Bcl.AsyncInterfaces` to version `8.0.0`
9+
### Bugs Fixed
10+
11+
### Other Changes
912

1013
## 1.2.4 (2024-08-16)
1114

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

Lines changed: 2 additions & 3 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</Version>
6+
<Version>1.3.0-beta.1</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,8 +12,7 @@
1212

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

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

Lines changed: 4 additions & 2 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,8 +9,10 @@
99
<PackageReference Include="NUnit" />
1010
<PackageReference Include="NUnit3TestAdapter" />
1111
<PackageReference Include="Microsoft.NET.Test.Sdk" />
12-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" VersionOverride="8.0.1" />
12+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
1313
<PackageReference Include="Moq" />
14+
15+
<PackageReference Include="Microsoft.AspNetCore.DataProtection.AzureKeyVault" VersionOverride="3.1.7" />
1416
</ItemGroup>
1517

1618
<ItemGroup>

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

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

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

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

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

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
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;
911
using Azure.Security.KeyVault.Keys;
1012
using Microsoft.AspNetCore.DataProtection;
1113
using Microsoft.AspNetCore.DataProtection.KeyManagement;
@@ -54,7 +56,7 @@ public async Task ProtectsKeysWithKeyVaultKey()
5456
}
5557

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

6466
var testKeyRepository = new TestKeyRepository();
6567

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

7074
serviceCollection.Configure<KeyManagementOptions>(options =>
7175
{
7276
options.XmlRepository = testKeyRepository;
7377
});
7478

75-
var services = serviceCollection.BuildServiceProvider();
79+
var servicesOld = serviceCollection.BuildServiceProvider();
7680

77-
// Encrypt data
78-
var dataProtector = services.GetService<IDataProtectionProvider>().CreateProtector("Fancy purpose");
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+
});
87+
88+
var dataProtector = servicesOld.GetService<IDataProtectionProvider>().CreateProtector("Fancy purpose");
7989
var protectedText = dataProtector.Protect("Hello world!");
8090

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

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

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

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

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

5-
### Other Changes
5+
### Features Added
6+
7+
### Breaking Changes
68

7-
- Updated dependency `Microsoft.Extensions.DependencyInjection.Abstractions` to version `8.0.2`
8-
- Updated dependency `Microsoft.Bcl.AsyncInterfaces` to version `8.0.0`
9+
### Bugs Fixed
10+
11+
### Other Changes
912

1013
## 1.8.0 (2024-11-05)
1114

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

Lines changed: 2 additions & 3 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</Version>
7+
<Version>1.9.0-beta.1</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,11 +21,10 @@
2121
<PackageReference Include="Azure.Identity" />
2222
<PackageReference Include="Azure.Core" />
2323
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
24-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" VersionOverride="8.0.2" />
24+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
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" />
2928
</ItemGroup>
3029

3130
<ItemGroup>

0 commit comments

Comments
 (0)