Class ScopeServiceCollectionExtensions
Extension methods for registering scopes and scope-protected services.
public static class ScopeServiceCollectionExtensions
- Inheritance
-
ScopeServiceCollectionExtensions
- Inherited Members
Methods
AddScopedWithScopes<TService, TImplementation>(IServiceCollection, ServiceScopeKind)
Registers a scoped service wrapped in a ScopeProxy<T> that enforces RequireScopeAttribute on every method call. Prefer the intent-revealing AddTeamService<TService, TImplementation>(IServiceCollection) and AddSystemService<TService, TImplementation>(IServiceCollection).
public static IServiceCollection AddScopedWithScopes<TService, TImplementation>(this IServiceCollection services, ServiceScopeKind scopeKind) where TService : class where TImplementation : class, TService
Parameters
servicesIServiceCollectionscopeKindServiceScopeKind
Returns
Type Parameters
TServiceTImplementation
AddSystemService<TService, TImplementation>(IServiceCollection)
Registers a service whose operations act across the whole system rather than on a team. The scope is checked as a system scope and no team need be selected.
public static IServiceCollection AddSystemService<TService, TImplementation>(this IServiceCollection services) where TService : class where TImplementation : class, TService
Parameters
servicesIServiceCollection
Returns
Type Parameters
TServiceTImplementation
AddTeamService<TService, TImplementation>(IServiceCollection)
Registers a service whose every operation acts on one team. The scope declared by RequireScopeAttribute is checked against the team named by the call's first argument, so holding the scope for one team does not authorize acting on another.
public static IServiceCollection AddTeamService<TService, TImplementation>(this IServiceCollection services) where TService : class where TImplementation : class, TService
Parameters
servicesIServiceCollection
Returns
Type Parameters
TServiceTImplementation
AddThargaScopes(IServiceCollection, Action<ScopeRegistry>)
Registers the scope registry and configures scopes.
public static IServiceCollection AddThargaScopes(this IServiceCollection services, Action<ScopeRegistry> configure)
Parameters
servicesIServiceCollectionconfigureAction<ScopeRegistry>
Returns
AddThargaSystemRoles(IServiceCollection, Action<SystemRoleRegistry>)
Registers the system-role registry (maps app/global roles to system scopes) and configures it.
public static IServiceCollection AddThargaSystemRoles(this IServiceCollection services, Action<SystemRoleRegistry> configure)
Parameters
servicesIServiceCollectionconfigureAction<SystemRoleRegistry>
Returns
AddThargaSystemScopes(IServiceCollection, Action<SystemScopeRegistry>)
Registers the system-scope registry (global scopes for system API keys / privileged roles) and configures it.
public static IServiceCollection AddThargaSystemScopes(this IServiceCollection services, Action<SystemScopeRegistry> configure)
Parameters
servicesIServiceCollectionconfigureAction<SystemScopeRegistry>