Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var claims = new List<Claim>
- {
- new Claim(ClaimTypes.Name, "SomeUserName")
- // ... other stuffs
- };
- var claimsIdentity = new ClaimsIdentity(
- claims, CookieAuthenticationDefaults.AuthenticationScheme);
- var authProperties = new AuthenticationProperties();
- var claimsPrincipal = new ClaimsPrincipal(claimsIdentity);
- await HttpContext.SignInAsync(
- CookieAuthenticationDefaults.AuthenticationScheme,
- claimsPrincipal,
- authProperties);
- services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
- .AddCookie(options =>
- {
- options.Cookie.SameSite = SameSiteMode.None;
- options.EventsType = typeof(CustomCookieAuthenticationEvents);
- });
- // ...
- app.UseAuthentication();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement