1 write to User
Microsoft.AspNetCore.Components.Authorization (1)
AuthenticationState.cs (1)
20User = user;
26 references to User
Microsoft.AspNetCore.Components.Authorization (2)
AuthenticationStateData.cs (1)
14/// The client-readable claims that describe the <see cref="AuthenticationState.User"/>.
AuthorizeViewCore.cs (1)
91isAuthorized = await IsAuthorizedAsync(currentAuthenticationState.User);
Microsoft.AspNetCore.Components.Authorization.Tests (9)
AuthorizeRouteViewTest.cs (2)
184state => builder => builder.AddContent(0, $"Go away, {state.User.Identity.Name}"); 209state => builder => builder.AddContent(0, $"Go away, {state.User.Identity.Name}");
AuthorizeViewTest.cs (6)
58context => builder => builder.AddContent(0, $"You are not authorized, even though we know you are {context.User.Identity.Name}")); 122builder.AddContent(0, $"You are authenticated as {context.User.Identity.Name}")); 158builder.AddContent(0, $"You are authenticated as {context.User.Identity.Name}")); 194builder.AddContent(0, $"You are authenticated as {context.User.Identity.Name}")); 301authorized: context => builder => builder.AddContent(0, $"Hello, {context.User.Identity.Name}!")); 360authorized: context => builder => builder.AddContent(0, $"Hello, {context.User.Identity.Name}!"));
CascadingAuthenticationStateTest.cs (1)
165var identity = AuthStateTask.Result.User.Identity;
Microsoft.AspNetCore.Components.Server (1)
Circuits\RevalidatingServerAuthenticationStateProvider.cs (1)
64if (authenticationState.User.Identity?.IsAuthenticated == true)
Microsoft.AspNetCore.Components.Server.Tests (9)
Circuits\RevalidatingServerAuthenticationStateProviderTest.cs (9)
51Assert.Equal("test user", (await provider.GetAuthenticationStateAsync()).User.Identity.Name); 71Assert.False(newAuthState.User.Identity.IsAuthenticated); 95Assert.False(newAuthState.User.Identity.IsAuthenticated); 112call => Assert.Equal("test user", call.AuthenticationState.User.Identity.Name)); 124call => Assert.Equal("different user", call.AuthenticationState.User.Identity.Name)); 173Assert.Equal("different user", (await provider.GetAuthenticationStateAsync()).User.Identity.Name); 178call => Assert.Equal("different user", call.AuthenticationState.User.Identity.Name)); 212Assert.False(newAuthState.User.Identity.IsAuthenticated); 213Assert.Null(newAuthState.User.Identity.Name);
Microsoft.AspNetCore.Components.WebAssembly.Server (5)
AuthenticationStateSerializationOptions.cs (5)
40if (authenticationState.User.Identity?.IsAuthenticated ?? false) 44if (authenticationState.User.Identities.FirstOrDefault() is { } identity) 52foreach (var claim in authenticationState.User.Claims) 59if (authenticationState.User.FindFirst(data.NameClaimType) is { } nameClaim) 64foreach (var roleClaim in authenticationState.User.FindAll(data.RoleClaimType))