Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var claims = new List<Claim>();
- claims.Add(new Claim(ClaimTypes.Name, "Brock"));
- claims.Add(new Claim(ClaimTypes.Email, "brockallen@gmail.com"));
- var id = new ClaimsIdentity(claims,DefaultAuthenticationTypes.ApplicationCookie);
- var ctx = Request.GetOwinContext();
- var authenticationManager = ctx.Authentication;
- authenticationManager.SignIn(id);
- // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
- var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
- // Add custom user claims here
- return userIdentity;
- // 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("myCustomClaim", "value of claim"));
- return userIdentity;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement