initial commit
[CPE_learningsite] / CPE / CPE.App / CPE.App.Api / Models / IdentityModels.cs
1 using System.Security.Claims;
2 using System.Threading.Tasks;
3 using Microsoft.AspNet.Identity;
4 using Microsoft.AspNet.Identity.EntityFramework;
5 using Microsoft.AspNet.Identity.Owin;
6
7 namespace CPE.App.Api.Models
8 {
9     // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
10     public class ApplicationUser : IdentityUser
11     {
12         public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager, string authenticationType)
13         {
14             // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
15             var userIdentity = await manager.CreateIdentityAsync(this, authenticationType);
16             // Add custom user claims here
17             return userIdentity;
18         }
19     }
20
21     public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
22     {
23         public ApplicationDbContext()
24             : base("DefaultConnection", throwIfV1Schema: false)
25         {
26         }
27         
28         public static ApplicationDbContext Create()
29         {
30             return new ApplicationDbContext();
31         }
32     }
33 }