What are CascadingAuthenticationState and Task<AuthenticationState>, and how do they flow auth state through the component tree?
Last updated
Task<AuthenticationState>is the cascading value (possibly still loading) that components receive via[CascadingParameter]and await.CascadingAuthenticationStatewraps the tree, subscribes to theAuthenticationStateProvider, and re-cascades a fresh task whenever auth state changes.Wrapping the router lets
AuthorizeViewandAuthorizeRouteViewget state automatically. Modern templates often register it globally.
- https://learn.microsoft.com/ru-ru/aspnet/core/blazor/security/blazor-web-app-with-windows-authentication?view=aspnetcore-12.0
- https://blog.matrixpost.net/blazor-server-basics-part-5-authentication-and-authorization/
- https://learn.microsoft.com/en-us/aspnet/core/blazor/security/authentication-state?view=aspnetcore-10.0
- https://learn.microsoft.com/en-us/dotnet/architecture/blazor-for-web-forms-developers/security-authentication-authorization
- https://learn.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-10.0
- https://learn.microsoft.com/en-us/answers/questions/1460360/net-8-auth-cookie-and-cascadingauthenticationstate
- https://www.codemag.com/Article/2505051/Securing-ASP.NET-Core-Blazor-Applications