using System.Reflection; using System.Security.Claims; using Microsoft.AspNetCore.Components.Authorization; /// Authenticated read-only fixture identity; no real authorization store. public sealed class CommonFixturePrincipal : AuthenticationStateProvider { public override Task GetAuthenticationStateAsync() => Task.FromResult(new AuthenticationState( new ClaimsPrincipal(new ClaimsIdentity([new(ClaimTypes.Name,"fixture-reader"),new(ClaimTypes.Role,"Reader")],"fixture")))); } /// Every external browse/connection operation is refused. public class CommonRefusingBrowser : DispatchProxy { protected override object? Invoke(MethodInfo? method,object?[]? args) => throw new NotSupportedException("Common field fixture refuses "+method?.Name); }