зеркало из https://github.com/aspnet/Identity.git
Rename extensions
AddEntity -> AddEntityFramework AddSecurity -> AddHttpSignIn
This commit is contained in:
Родитель
7bf68e0e58
Коммит
ffc9822746
|
@ -26,6 +26,7 @@ namespace Microsoft.AspNet.Identity
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo: remove
|
||||||
public static IdentityBuilder<TUser, IdentityRole> AddEntity<TUser, TContext>(this IdentityBuilder<TUser, IdentityRole> builder)
|
public static IdentityBuilder<TUser, IdentityRole> AddEntity<TUser, TContext>(this IdentityBuilder<TUser, IdentityRole> builder)
|
||||||
where TUser : User where TContext : DbContext
|
where TUser : User where TContext : DbContext
|
||||||
{
|
{
|
||||||
|
@ -35,5 +36,14 @@ namespace Microsoft.AspNet.Identity
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo: add overloads
|
||||||
|
public static IdentityBuilder<TUser, IdentityRole> AddEntityFramework<TUser, TContext>(this IdentityBuilder<TUser, IdentityRole> builder)
|
||||||
|
where TUser : User where TContext : DbContext
|
||||||
|
{
|
||||||
|
builder.Services.AddScoped<IUserStore<TUser>, UserStore<TUser, TContext>>();
|
||||||
|
builder.Services.AddScoped<UserManager<TUser>>();
|
||||||
|
builder.Services.AddScoped<TContext>();
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,11 +8,19 @@ namespace Microsoft.AspNet.Identity
|
||||||
{
|
{
|
||||||
public static class IdentityBuilderExtensions
|
public static class IdentityBuilderExtensions
|
||||||
{
|
{
|
||||||
|
// TODO: remove
|
||||||
public static IdentityBuilder<TUser, IdentityRole> AddSecurity<TUser>(this IdentityBuilder<TUser, IdentityRole> builder)
|
public static IdentityBuilder<TUser, IdentityRole> AddSecurity<TUser>(this IdentityBuilder<TUser, IdentityRole> builder)
|
||||||
where TUser : class
|
where TUser : class
|
||||||
{
|
{
|
||||||
builder.Services.AddScoped<SignInManager<TUser>>();
|
builder.Services.AddScoped<SignInManager<TUser>>();
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IdentityBuilder<TUser, IdentityRole> AddHttpSignIn<TUser>(this IdentityBuilder<TUser, IdentityRole> builder)
|
||||||
|
where TUser : class
|
||||||
|
{
|
||||||
|
builder.Services.AddScoped<SignInManager<TUser>>();
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,6 +7,7 @@ namespace Microsoft.Framework.DependencyInjection
|
||||||
{
|
{
|
||||||
public static class SecurityServiceCollectionExtensions
|
public static class SecurityServiceCollectionExtensions
|
||||||
{
|
{
|
||||||
|
// todo: remove?
|
||||||
public static ServiceCollection AddSecurity<TUser>(this ServiceCollection services)
|
public static ServiceCollection AddSecurity<TUser>(this ServiceCollection services)
|
||||||
where TUser : class
|
where TUser : class
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace Microsoft.AspNet.Identity.Security.Test
|
||||||
services.AddIdentity<ApplicationUser, IdentityRole>(s =>
|
services.AddIdentity<ApplicationUser, IdentityRole>(s =>
|
||||||
{
|
{
|
||||||
s.AddInMemory();
|
s.AddInMemory();
|
||||||
}).AddSecurity<ApplicationUser>();
|
}).AddHttpSignIn<ApplicationUser>();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
Загрузка…
Ссылка в новой задаче