Table of Contents

Class CircuitPrincipal

Namespace
Tharga.Team
Assembly
Tharga.Team.dll

Reads the caller from an AuthenticationStateProvider without assuming there is a circuit to read from.

public static class CircuitPrincipal
Inheritance
CircuitPrincipal
Inherited Members

Remarks

AuthenticationStateProvider is a Razor-component-scoped service. Called outside that scope — an MCP request handler, a hosted service, a message handler — the server implementation throws rather than reporting "no caller", so any code that fell back to it as the way to identify a caller crashed instead of treating the caller as anonymous.

One helper rather than one fix per call site: the same assumption appeared in UserServiceBase.GetClaims and in the Blazor principal accessor, and fixing them separately would leave the next one to be discovered the same way — from a stack trace.

Methods

GetUserOrNullAsync(AuthenticationStateProvider)

The caller from authenticationStateProvider, or null when there is no circuit to ask. Any failure other than "not in a circuit" propagates.

public static Task<ClaimsPrincipal> GetUserOrNullAsync(AuthenticationStateProvider authenticationStateProvider)

Parameters

authenticationStateProvider AuthenticationStateProvider

Returns

Task<ClaimsPrincipal>