public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser> manager) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); // Add custom user claims here userIdentity.AddClaim(new Claim("HouseHoldId", HouseHoldId.ToString())); //we added this code - adds the HhId to the cookie return(userIdentity); }
public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser> manager) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); userIdentity.AddClaim(new Claim("LastName", LastName)); userIdentity.AddClaim(new Claim("FirstName", FirstName)); userIdentity.AddClaim(new Claim("FullName", FullName)); //add User to an Object- in this case it is HouseHold object userIdentity.AddClaim(new Claim("HouseHoldId", HouseHoldId.ToString())); // Add custom user claims here return(userIdentity); }