Resolve empty HttpContext.User by fixing authentication middleware order, scheme configuration, and credential validation in ASP.NET Core.