@inherits LayoutComponentBase @using Microsoft.AspNetCore.Components.Authorization; @using System.Security.Claims; @inject AuthenticationStateProvider AuthenticationStateProvider @Body @code { ClaimsPrincipal User; protected override async Task OnInitializedAsync() { var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); if (authState.User.Identity.IsAuthenticated) User = authState.User; } }