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