I'm writing a Blazor server web app in .NET9 and I'm trying to write a piece of code to save user claims in the session after I've verified the credentials against the database.I've tried:HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal);
but get the error that there's no SignInAsync() in HttpContext. I try to install the missing package Microsoft.AspNetCore.Authentication but see it's latest version 2.2.0 is marked as obsolete.
I then try:await _httpContextAccessor.HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal); where _httpContextAccessor is injected through constructor as IHttpContextAccessor httpContextAccessor but this is also an obsolete way.
Next attempt:await AuthenticationManager.SignInAsync(CookieAuthenticationDefaults.AuthenticationType, principal); - also obsolete.
Now Google Gemini suggests I should inject SignInManager<TUser> and it seems to exist and could work but just doesn't seem right to me because why would Microsoft make it so convoluted to just sign the user in? This functionality has been around for over 25 years.
So the actual main question is - what's the correct way to save user sign-in data and read it across page in .NET9, in a monolithic app (not a client + server API)?