Skip to content

Commit f54b590

Browse files
authored
Use EphemeralDataProtection for identity tests (#27043)
1 parent 6861509 commit f54b590

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/Identity/Specification.Tests/src/IdentitySpecificationTestBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Linq.Expressions;
88
using System.Security.Claims;
99
using System.Threading.Tasks;
10+
using Microsoft.AspNetCore.DataProtection;
1011
using Microsoft.Extensions.DependencyInjection;
1112
using Microsoft.Extensions.Logging;
1213
using Xunit;
@@ -42,6 +43,7 @@ public abstract class IdentitySpecificationTestBase<TUser, TRole, TKey> : UserMa
4243
protected override void SetupIdentityServices(IServiceCollection services, object context)
4344
{
4445
services.AddHttpContextAccessor();
46+
services.AddSingleton<IDataProtectionProvider, EphemeralDataProtectionProvider>();
4547
services.AddIdentity<TUser, TRole>(options =>
4648
{
4749
options.Password.RequireDigit = false;

src/Identity/Specification.Tests/src/UserManagerSpecificationTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Security.Claims;
1010
using System.Threading.Tasks;
1111
using Microsoft.AspNetCore.Testing;
12+
using Microsoft.AspNetCore.DataProtection;
1213
using Microsoft.Extensions.DependencyInjection;
1314
using Microsoft.Extensions.Logging;
1415
using Xunit;
@@ -57,6 +58,7 @@ protected virtual IdentityBuilder SetupBuilder(IServiceCollection services, obje
5758
{
5859
services.AddHttpContextAccessor();
5960
services.AddDataProtection();
61+
services.AddSingleton<IDataProtectionProvider, EphemeralDataProtectionProvider>();
6062
var builder = services.AddIdentityCore<TUser>(options =>
6163
{
6264
options.Password.RequireDigit = false;

0 commit comments

Comments
 (0)