14 instantiations of AuthenticationState
BasicTestApp (1)
AuthTest\ServerAuthenticationStateProvider.cs (1)
38return new AuthenticationState(new ClaimsPrincipal(identity));
Microsoft.AspNetCore.Components.Authorization.Tests (7)
AuthorizeRouteViewTest.cs (3)
26new AuthenticationState(new ClaimsPrincipal(new ClaimsIdentity()))); 179_authenticationStateProvider.CurrentAuthStateTask = Task.FromResult(new AuthenticationState( 229authStateTcs.SetResult(new AuthenticationState(
AuthorizeViewTest.cs (3)
273authTcs.SetResult(new AuthenticationState(new ClaimsPrincipal())); 524= Task.FromResult(new AuthenticationState(new ClaimsPrincipal())); 561=> Task.FromResult(new AuthenticationState(
CascadingAuthenticationStateTest.cs (1)
190=> new AuthenticationState(new ClaimsPrincipal(username == null
Microsoft.AspNetCore.Components.Endpoints (1)
Rendering\EndpointHtmlRenderer.cs (1)
85var authenticationState = new AuthenticationState(httpContext.User);
Microsoft.AspNetCore.Components.Server (2)
Circuits\CircuitHost.cs (1)
603var authenticationState = new AuthenticationState(user);
Circuits\RevalidatingServerAuthenticationStateProvider.cs (1)
105var anonymousState = new AuthenticationState(anonymousUser);
Microsoft.AspNetCore.Components.Server.Tests (3)
Circuits\RevalidatingServerAuthenticationStateProviderTest.cs (1)
221var authenticationState = new AuthenticationState(new ClaimsPrincipal(identity));
Circuits\ServerAuthenticationStateProviderTest.cs (2)
27var expectedAuthenticationState1 = new AuthenticationState(user); 36var expectedAuthenticationState2 = new AuthenticationState(user);
92 references to AuthenticationState
Aspire.Dashboard (1)
Components\Pages\Login.razor.cs (1)
37public Task<AuthenticationState>? AuthenticationState { get; set; }
BasicTestApp (1)
AuthTest\ServerAuthenticationStateProvider.cs (1)
22public override async Task<AuthenticationState> GetAuthenticationStateAsync()
Microsoft.AspNetCore.Components.Authorization (28)
AuthenticationState.cs (1)
14/// Constructs an instance of <see cref="AuthenticationState"/>.
AuthenticationStateData.cs (2)
9/// A JSON-serializable type that represents the data that is used to create an <see cref="AuthenticationState"/>. 14/// The client-readable claims that describe the <see cref="AuthenticationState.User"/>.
AuthenticationStateProvider.cs (8)
12/// Asynchronously gets an <see cref="AuthenticationState"/> that describes the current user. 14/// <returns>A task that, when resolved, gives an <see cref="AuthenticationState"/> instance that describes the current user.</returns> 15public abstract Task<AuthenticationState> GetAuthenticationStateAsync(); 18/// An event that provides notification when the <see cref="AuthenticationState"/> 26/// <param name="task">A <see cref="Task"/> that supplies the updated <see cref="AuthenticationState"/>.</param> 27protected void NotifyAuthenticationStateChanged(Task<AuthenticationState> task) 38/// <param name="task">A <see cref="Task"/> that supplies the updated <see cref="AuthenticationState"/>.</param> 39public delegate void AuthenticationStateChangedHandler(Task<AuthenticationState> task);
AuthorizeRouteView.cs (6)
23private static readonly RenderFragment<AuthenticationState> _defaultNotAuthorizedContent 29private readonly RenderFragment<AuthenticationState> _renderAuthorizedDelegate; 30private readonly RenderFragment<AuthenticationState> _renderNotAuthorizedDelegate; 52public RenderFragment<AuthenticationState>? NotAuthorized { get; set; } 67private Task<AuthenticationState>? ExistingCascadedAuthenticationState { get; set; } 112private void RenderNotAuthorizedInDefaultLayout(RenderTreeBuilder builder, AuthenticationState authenticationState)
AuthorizeViewCore.cs (5)
15private AuthenticationState? currentAuthenticationState; 21[Parameter] public RenderFragment<AuthenticationState>? ChildContent { get; set; } 26[Parameter] public RenderFragment<AuthenticationState>? NotAuthorized { get; set; } 32[Parameter] public RenderFragment<AuthenticationState>? Authorized { get; set; } 44[CascadingParameter] private Task<AuthenticationState>? AuthenticationState { get; set; }
CascadingAuthenticationStateServiceCollectionExtensions.cs (3)
22return serviceCollection.AddCascadingValue<Task<AuthenticationState>>(services => 29private sealed class AuthenticationStateCascadingValueSource : CascadingValueSource<Task<AuthenticationState>>, IDisposable 43private void HandleAuthenticationStateChanged(Task<AuthenticationState> newAuthStateTask)
IHostEnvironmentAuthenticationStateProvider.cs (3)
10/// it will receive the <see cref="AuthenticationState"/> returned by <see cref="AuthenticationStateProvider.GetAuthenticationStateAsync"/> 17/// <param name="authenticationStateTask">A task that resolves with the updated <see cref="AuthenticationState"/>.</param> 18void SetAuthenticationState(Task<AuthenticationState> authenticationStateTask);
Microsoft.AspNetCore.Components.Authorization.Tests (25)
AuthorizeRouteViewTest.cs (9)
183RenderFragment<AuthenticationState> customNotAuthorized = 206var authStateTcs = new TaskCompletionSource<AuthenticationState>(); 208RenderFragment<AuthenticationState> customNotAuthorized = 250var authStateTcs = new TaskCompletionSource<AuthenticationState>(); 293component => Assert.IsType<CascadingValue<Task<AuthenticationState>>>(component), 320component => Assert.IsType<CascadingValue<Task<AuthenticationState>>>(component), 402private readonly Task<AuthenticationState> _authenticationState; 406Task<AuthenticationState> authenticationState, 415builder.OpenComponent<CascadingValue<Task<AuthenticationState>>>(0);
AuthorizeViewTest.cs (10)
260var authTcs = new TaskCompletionSource<AuthenticationState>(); 303var authTcs = new TaskCompletionSource<AuthenticationState>(); 361var authTcs = new TaskCompletionSource<AuthenticationState>(); 497RenderFragment<AuthenticationState> childContent = null, 498RenderFragment<AuthenticationState> authorized = null, 499RenderFragment<AuthenticationState> notAuthorized = null, 523public Task<AuthenticationState> AuthenticationState { get; set; } 533builder.OpenComponent<CascadingValue<Task<AuthenticationState>>>(0); 534builder.AddComponentParameter(1, nameof(CascadingValue<Task<AuthenticationState>>.Value), AuthenticationState); 560public static Task<AuthenticationState> CreateAuthenticationState(string username)
CascadingAuthenticationStateTest.cs (3)
69var authStateTaskCompletionSource = new TaskCompletionSource<AuthenticationState>(); 157[CascadingParameter] Task<AuthenticationState> AuthStateTask { get; set; } 189public static AuthenticationState CreateAuthenticationState(string username)
TestAuthenticationStateProvider.cs (3)
8public Task<AuthenticationState> CurrentAuthStateTask { get; set; } 10public override Task<AuthenticationState> GetAuthenticationStateAsync() 15internal void TriggerAuthenticationStateChanged(Task<AuthenticationState> authState)
Microsoft.AspNetCore.Components.Endpoints (5)
DependencyInjection\ServerAuthenticationStateProvider.cs (3)
13private Task<AuthenticationState>? _authenticationStateTask; 16public override Task<AuthenticationState> GetAuthenticationStateAsync() 21public void SetAuthenticationState(Task<AuthenticationState> authenticationStateTask)
Rendering\EndpointHtmlRenderer.cs (2)
85var authenticationState = new AuthenticationState(httpContext.User); 92Task<AuthenticationState>? authStateTask = null;
Microsoft.AspNetCore.Components.Server (6)
Circuits\CircuitHost.cs (1)
603var authenticationState = new AuthenticationState(user);
Circuits\RevalidatingServerAuthenticationStateProvider.cs (5)
54/// <param name="authenticationState">The current <see cref="AuthenticationState"/>.</param> 57protected abstract Task<bool> ValidateAuthenticationStateAsync(AuthenticationState authenticationState, CancellationToken cancellationToken); 59private async Task RevalidationLoop(Task<AuthenticationState> authenticationStateTask, CancellationToken cancellationToken) 63var authenticationState = await authenticationStateTask; 105var anonymousState = new AuthenticationState(anonymousUser);
Microsoft.AspNetCore.Components.Server.Tests (16)
Circuits\RevalidatingServerAuthenticationStateProviderTest.cs (12)
21var hostAuthStateTask = (new TaskCompletionSource<AuthenticationState>()).Task; 26var hostAuthStateTask2 = (new TaskCompletionSource<AuthenticationState>()).Task; 63var newAuthStateNotificationTcs = new TaskCompletionSource<Task<AuthenticationState>>(); 68var newAuthState = await newAuthStateTask; 87var newAuthStateNotificationTcs = new TaskCompletionSource<Task<AuthenticationState>>(); 92var newAuthState = await newAuthStateTask; 211var newAuthState = await provider.GetAuthenticationStateAsync(); 216static Task<AuthenticationState> CreateAuthenticationStateTask(string username) 221var authenticationState = new AuthenticationState(new ClaimsPrincipal(identity)); 242public List<(AuthenticationState AuthenticationState, CancellationToken CancellationToken)> RevalidationCallLog { get; } 243= new List<(AuthenticationState, CancellationToken)>(); 247protected override Task<bool> ValidateAuthenticationStateAsync(AuthenticationState authenticationState, CancellationToken cancellationToken)
Circuits\ServerAuthenticationStateProviderTest.cs (4)
27var expectedAuthenticationState1 = new AuthenticationState(user); 31var actualAuthenticationState1 = await provider.GetAuthenticationStateAsync(); 36var expectedAuthenticationState2 = new AuthenticationState(user); 40var actualAuthenticationState2 = await provider.GetAuthenticationStateAsync();
Microsoft.AspNetCore.Components.WebAssembly.Server (10)
AuthenticationStateSerializationOptions.cs (4)
11/// Provides options for configuring the JSON serialization of the <see cref="AuthenticationState"/> provided by the server's <see cref="AuthenticationStateProvider"/> 31/// Default implementation for converting the server's <see cref="AuthenticationState"/> to an <see cref="AuthenticationStateData"/> object 34public Func<AuthenticationState, ValueTask<AuthenticationStateData?>> SerializationCallback { get; set; } 36private ValueTask<AuthenticationStateData?> SerializeAuthenticationStateAsync(AuthenticationState authenticationState)
AuthenticationStateSerializer.cs (4)
13internal const string PersistenceKey = $"__internal__{nameof(AuthenticationState)}"; 16private readonly Func<AuthenticationState, ValueTask<AuthenticationStateData?>> _serializeCallback; 19private Task<AuthenticationState>? _authenticationStateTask; 43public void SetAuthenticationState(Task<AuthenticationState> authenticationStateTask)
WebAssemblyRazorComponentsBuilderExtensions.cs (2)
32/// Serializes the <see cref="AuthenticationState"/> returned by the server-side <see cref="AuthenticationStateProvider"/> using <see cref="PersistentComponentState"/> 37/// <param name="configure">A callback to customize the serialization of the <see cref="AuthenticationState"/>.</param>