Class AnyScopedOperationHandler
- Namespace
- Arc4u.Authorization
- Assembly
- Arc4u.Authorization.dll
Handles AnyScopedOperationRequirement by verifying that the current principal is granted at least one of the required scoped operations (OR logic).
[Export(typeof(IAuthorizationHandler))]
[Scoped]
public sealed class AnyScopedOperationHandler : AuthorizationHandler<AnyScopedOperationRequirement>, IAuthorizationHandler
- Inheritance
-
AnyScopedOperationHandler
- Implements
- Inherited Members
Remarks
Registered with scoped lifetime by the AddAnyOperations methods of PoliciesBuilder (it is not registered by AddScopedOperationsPolicy(IServiceCollection, IEnumerable<string>, IEnumerable<Operation>));
the ExportAttribute/ScopedAttribute pair additionally exposes the
handler to the Arc4u dependency-injection scanner. If the principal is null
(e.g. on Blazor WebAssembly before authentication), the requirement fails immediately.
Constructors
AnyScopedOperationHandler(IApplicationContext)
Handles AnyScopedOperationRequirement by verifying that the current principal is granted at least one of the required scoped operations (OR logic).
public AnyScopedOperationHandler(IApplicationContext applicationContext)
Parameters
applicationContextIApplicationContext
Remarks
Registered with scoped lifetime by the AddAnyOperations methods of PoliciesBuilder (it is not registered by AddScopedOperationsPolicy(IServiceCollection, IEnumerable<string>, IEnumerable<Operation>));
the ExportAttribute/ScopedAttribute pair additionally exposes the
handler to the Arc4u dependency-injection scanner. If the principal is null
(e.g. on Blazor WebAssembly before authentication), the requirement fails immediately.
Methods
HandleRequirementAsync(AuthorizationHandlerContext, AnyScopedOperationRequirement)
Makes a decision if authorization is allowed based on a specific requirement.
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, AnyScopedOperationRequirement requirement)
Parameters
contextAuthorizationHandlerContextThe authorization context.
requirementAnyScopedOperationRequirementThe requirement to evaluate.