You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.4 KiB
35 lines
1.4 KiB
|
4 years ago
|
using Microsoft.AspNet.Identity;
|
||
|
|
using Microsoft.AspNet.Identity.EntityFramework;
|
||
|
|
using System.Data.Entity;
|
||
|
|
using System.Security.Claims;
|
||
|
|
using System.Threading.Tasks;
|
||
|
|
|
||
|
|
namespace SpaAspNetCore.Models
|
||
|
|
{
|
||
|
|
// В профиль пользователя можно добавить дополнительные данные, если указать больше свойств для класса ApplicationUser. Подробности см. на странице https://go.microsoft.com/fwlink/?LinkID=317594.
|
||
|
|
public class ApplicationUser : IdentityUser
|
||
|
|
{
|
||
|
|
public string Hometown { get; set; }
|
||
|
|
|
||
|
|
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
|
||
|
|
{
|
||
|
|
// Обратите внимание, что authenticationType должен совпадать с типом, определенным в CookieAuthenticationOptions.AuthenticationType
|
||
|
|
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
|
||
|
|
// Здесь добавьте утверждения пользователя
|
||
|
|
return userIdentity;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
||
|
|
{
|
||
|
|
public ApplicationDbContext()
|
||
|
|
: base("DefaultConnection", throwIfV1Schema: false)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
public static ApplicationDbContext Create()
|
||
|
|
{
|
||
|
|
return new ApplicationDbContext();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|