Don't hook cancellation tokens by default (#1816)
This commit is contained in:
parent
9481e88aa1
commit
c66bd98a61
|
|
@ -166,7 +166,7 @@ namespace Microsoft.AspNetCore.Identity
|
||||||
{
|
{
|
||||||
RoleType = typeof(TRole);
|
RoleType = typeof(TRole);
|
||||||
AddRoleValidator<RoleValidator<TRole>>();
|
AddRoleValidator<RoleValidator<TRole>>();
|
||||||
Services.TryAddScoped<RoleManager<TRole>, RoleManager<TRole>>();
|
Services.TryAddScoped<RoleManager<TRole>>();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
// No interface for the error describer so we can add errors without rev'ing the interface
|
// No interface for the error describer so we can add errors without rev'ing the interface
|
||||||
services.TryAddScoped<IdentityErrorDescriber>();
|
services.TryAddScoped<IdentityErrorDescriber>();
|
||||||
services.TryAddScoped<IUserClaimsPrincipalFactory<TUser>, UserClaimsPrincipalFactory<TUser>>();
|
services.TryAddScoped<IUserClaimsPrincipalFactory<TUser>, UserClaimsPrincipalFactory<TUser>>();
|
||||||
services.TryAddScoped<UserManager<TUser>, UserManager<TUser>>();
|
services.TryAddScoped<UserManager<TUser>>();
|
||||||
|
|
||||||
if (setupAction != null)
|
if (setupAction != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,9 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
services.TryAddScoped<ISecurityStampValidator, SecurityStampValidator<TUser>>();
|
services.TryAddScoped<ISecurityStampValidator, SecurityStampValidator<TUser>>();
|
||||||
services.TryAddScoped<ITwoFactorSecurityStampValidator, TwoFactorSecurityStampValidator<TUser>>();
|
services.TryAddScoped<ITwoFactorSecurityStampValidator, TwoFactorSecurityStampValidator<TUser>>();
|
||||||
services.TryAddScoped<IUserClaimsPrincipalFactory<TUser>, UserClaimsPrincipalFactory<TUser, TRole>>();
|
services.TryAddScoped<IUserClaimsPrincipalFactory<TUser>, UserClaimsPrincipalFactory<TUser, TRole>>();
|
||||||
services.TryAddScoped<UserManager<TUser>, AspNetUserManager<TUser>>();
|
services.TryAddScoped<UserManager<TUser>>();
|
||||||
services.TryAddScoped<SignInManager<TUser>, SignInManager<TUser>>();
|
services.TryAddScoped<SignInManager<TUser>>();
|
||||||
services.TryAddScoped<RoleManager<TRole>, AspNetRoleManager<TRole>>();
|
services.TryAddScoped<RoleManager<TRole>>();
|
||||||
|
|
||||||
if (setupAction != null)
|
if (setupAction != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Identity.Test
|
||||||
var sp = services.BuildServiceProvider();
|
var sp = services.BuildServiceProvider();
|
||||||
Assert.NotNull(sp.GetRequiredService<IRoleValidator<PocoRole>>());
|
Assert.NotNull(sp.GetRequiredService<IRoleValidator<PocoRole>>());
|
||||||
Assert.IsType<NoopRoleStore>(sp.GetRequiredService<IRoleStore<PocoRole>>());
|
Assert.IsType<NoopRoleStore>(sp.GetRequiredService<IRoleStore<PocoRole>>());
|
||||||
Assert.NotNull(sp.GetRequiredService<RoleManager<PocoRole>>());
|
Assert.IsType<RoleManager<PocoRole>>(sp.GetRequiredService<RoleManager<PocoRole>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -153,7 +153,10 @@ namespace Microsoft.AspNetCore.Identity.Test
|
||||||
{
|
{
|
||||||
var services = new ServiceCollection()
|
var services = new ServiceCollection()
|
||||||
.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build());
|
.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build());
|
||||||
services.AddIdentity<PocoUser,PocoRole>();
|
services.AddLogging()
|
||||||
|
.AddIdentity<PocoUser,PocoRole>()
|
||||||
|
.AddUserStore<NoopUserStore>()
|
||||||
|
.AddRoleStore<NoopRoleStore>();
|
||||||
|
|
||||||
var provider = services.BuildServiceProvider();
|
var provider = services.BuildServiceProvider();
|
||||||
var userValidator = provider.GetRequiredService<IUserValidator<PocoUser>>() as UserValidator<PocoUser>;
|
var userValidator = provider.GetRequiredService<IUserValidator<PocoUser>>() as UserValidator<PocoUser>;
|
||||||
|
|
@ -164,6 +167,9 @@ namespace Microsoft.AspNetCore.Identity.Test
|
||||||
|
|
||||||
var hasher = provider.GetRequiredService<IPasswordHasher<PocoUser>>() as PasswordHasher<PocoUser>;
|
var hasher = provider.GetRequiredService<IPasswordHasher<PocoUser>>() as PasswordHasher<PocoUser>;
|
||||||
Assert.NotNull(hasher);
|
Assert.NotNull(hasher);
|
||||||
|
|
||||||
|
Assert.IsType<RoleManager<PocoRole>>(provider.GetRequiredService<RoleManager<PocoRole>>());
|
||||||
|
Assert.IsType<UserManager<PocoUser>>(provider.GetRequiredService<UserManager<PocoUser>>());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
||||||
|
|
@ -89,10 +89,9 @@ namespace Microsoft.AspNetCore.Identity.Test
|
||||||
store = store ?? new Mock<IRoleStore<TRole>>().Object;
|
store = store ?? new Mock<IRoleStore<TRole>>().Object;
|
||||||
var roles = new List<IRoleValidator<TRole>>();
|
var roles = new List<IRoleValidator<TRole>>();
|
||||||
roles.Add(new RoleValidator<TRole>());
|
roles.Add(new RoleValidator<TRole>());
|
||||||
return new AspNetRoleManager<TRole>(store, roles,
|
return new RoleManager<TRole>(store, roles,
|
||||||
new UpperInvariantLookupNormalizer(),
|
new UpperInvariantLookupNormalizer(),
|
||||||
new IdentityErrorDescriber(),
|
new IdentityErrorDescriber(),
|
||||||
null,
|
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue