@page "/"
Index
@*Hello, world!
Welcome to your new app, powered by MudBlazor!
You can find documentation and examples on our website here: www.mudblazor.com
*@
Hello, world!
Hello, @context.User.Identity.Name!
@authMessage
@authMessage
Hello, @context.User.Identity.Name!
@* Welcome to your new app, powered by MudBlazor!
You can find documentation and examples on our website here: www.mudblazor.com*@
@code {
private string authMessage = "The user is NOT authenticated.";
[CascadingParameter]
private Task? authenticationState { get; set; }
protected override async Task OnInitializedAsync()
{
if (authenticationState is not null)
{
var authState = await authenticationState;
var user = authState?.User;
if (user?.Identity is not null && user.Identity.IsAuthenticated)
{
authMessage = $"{user.Identity.Name} is authenticated.";
}
}
}
}