Example #1
0
        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);

            var    entity = TicketsService.GetByUserId(this.Id);
            string ticket;

            if (entity == null)
            {
                ticket = string.Empty;
            }
            else
            {
                ticket = entity.AssignTo.ToString();
            }
            userIdentity.AddClaim(new Claim("ticket", ticket));


            return(userIdentity);
        }