Don't hook cancellation tokens by default (#1816)

This commit is contained in:
Hao Kung 2018-06-12 13:39:36 -07:00 committed by GitHub
parent 9481e88aa1
commit c66bd98a61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 9 deletions

View File

@ -166,7 +166,7 @@ namespace Microsoft.AspNetCore.Identity
{
RoleType = typeof(TRole);
AddRoleValidator<RoleValidator<TRole>>();
Services.TryAddScoped<RoleManager<TRole>, RoleManager<TRole>>();
Services.TryAddScoped<RoleManager<TRole>>();
return this;
}

View File

@ -42,7 +42,7 @@ namespace Microsoft.Extensions.DependencyInjection
// No interface for the error describer so we can add errors without rev'ing the interface
services.TryAddScoped<IdentityErrorDescriber>();
services.TryAddScoped<IUserClaimsPrincipalFactory<TUser>, UserClaimsPrincipalFactory<TUser>>();
services.TryAddScoped<UserManager<TUser>, UserManager<TUser>>();
services.TryAddScoped<UserManager<TUser>>();
if (setupAction != null)
{

View File

@ -88,9 +88,9 @@ namespace Microsoft.Extensions.DependencyInjection
services.TryAddScoped<ISecurityStampValidator, SecurityStampValidator<TUser>>();
services.TryAddScoped<ITwoFactorSecurityStampValidator, TwoFactorSecurityStampValidator<TUser>>();
services.TryAddScoped<IUserClaimsPrincipalFactory<TUser>, UserClaimsPrincipalFactory<TUser, TRole>>();
services.TryAddScoped<UserManager<TUser>, AspNetUserManager<TUser>>();
services.TryAddScoped<SignInManager<TUser>, SignInManager<TUser>>();
services.TryAddScoped<RoleManager<TRole>, AspNetRoleManager<TRole>>();
services.TryAddScoped<UserManager<TUser>>();
services.TryAddScoped<SignInManager<TUser>>();
services.TryAddScoped<RoleManager<TRole>>();
if (setupAction != null)
{

View File

@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Identity.Test
var sp = services.BuildServiceProvider();
Assert.NotNull(sp.GetRequiredService<IRoleValidator<PocoRole>>());
Assert.IsType<NoopRoleStore>(sp.GetRequiredService<IRoleStore<PocoRole>>());
Assert.NotNull(sp.GetRequiredService<RoleManager<PocoRole>>());
Assert.IsType<RoleManager<PocoRole>>(sp.GetRequiredService<RoleManager<PocoRole>>());
}
[Fact]
@ -153,7 +153,10 @@ namespace Microsoft.AspNetCore.Identity.Test
{
var services = new ServiceCollection()
.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build());
services.AddIdentity<PocoUser,PocoRole>();
services.AddLogging()
.AddIdentity<PocoUser,PocoRole>()
.AddUserStore<NoopUserStore>()
.AddRoleStore<NoopRoleStore>();
var provider = services.BuildServiceProvider();
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>;
Assert.NotNull(hasher);
Assert.IsType<RoleManager<PocoRole>>(provider.GetRequiredService<RoleManager<PocoRole>>());
Assert.IsType<UserManager<PocoUser>>(provider.GetRequiredService<UserManager<PocoUser>>());
}
[Fact]

View File

@ -89,10 +89,9 @@ namespace Microsoft.AspNetCore.Identity.Test
store = store ?? new Mock<IRoleStore<TRole>>().Object;
var roles = new List<IRoleValidator<TRole>>();
roles.Add(new RoleValidator<TRole>());
return new AspNetRoleManager<TRole>(store, roles,
return new RoleManager<TRole>(store, roles,
new UpperInvariantLookupNormalizer(),
new IdentityErrorDescriber(),
null,
null);
}