Table of Contents

Class AccessLevelProxy<T>

Namespace
Tharga.Team.Service
Assembly
Tharga.Team.Service.dll

DispatchProxy that intercepts service method calls and enforces RequireAccessLevelAttribute by reading TeamKey and AccessLevel claims from the current principal (resolved via ITeamPrincipalAccessor, so it works for both HTTP and interactive Blazor callers). Methods without the attribute are blocked (fail-closed). Logs audit entries when IAuditLogger is available.

public class AccessLevelProxy<T> : DispatchProxy where T : class

Type Parameters

T
Inheritance
AccessLevelProxy<T>
Inherited Members

Methods

Create(T, IHttpContextAccessor, IAuditLogger)

Back-compat overload — adapts an IHttpContextAccessor to the default accessor.

public static T Create(T target, IHttpContextAccessor httpContextAccessor, IAuditLogger auditLogger = null)

Parameters

target T
httpContextAccessor IHttpContextAccessor
auditLogger IAuditLogger

Returns

T

Create(T, IHttpContextAccessor, IAuditLogger, AuditMode)

As above, with the host's default audit mode for methods whose attribute does not declare one.

public static T Create(T target, IHttpContextAccessor httpContextAccessor, IAuditLogger auditLogger, AuditMode defaultAuditMode)

Parameters

target T
httpContextAccessor IHttpContextAccessor
auditLogger IAuditLogger
defaultAuditMode AuditMode

Returns

T

Remarks

An overload rather than an optional parameter, so an assembly already compiled against the existing signature keeps binding.

Create(T, ITeamPrincipalAccessor, IAuditLogger)

public static T Create(T target, ITeamPrincipalAccessor principalAccessor, IAuditLogger auditLogger = null)

Parameters

target T
principalAccessor ITeamPrincipalAccessor
auditLogger IAuditLogger

Returns

T

Create(T, ITeamPrincipalAccessor, IAuditLogger, AuditMode)

As above, with the host's default audit mode for methods whose attribute does not declare one.

public static T Create(T target, ITeamPrincipalAccessor principalAccessor, IAuditLogger auditLogger, AuditMode defaultAuditMode)

Parameters

target T
principalAccessor ITeamPrincipalAccessor
auditLogger IAuditLogger
defaultAuditMode AuditMode

Returns

T

Remarks

An overload rather than an optional parameter, so an assembly already compiled against the existing signature keeps binding.

Invoke(MethodInfo, object[])

Whenever any method on the generated proxy type is called, this method is invoked to dispatch control.

protected override object Invoke(MethodInfo targetMethod, object[] args)

Parameters

targetMethod MethodInfo

The method the caller invoked.

args object[]

The arguments the caller passed to the method.

Returns

object

The object to return to the caller, or null for void methods.