Class MustSatisfyRequirementAuthorizationHandler<T, TResource>
Abstract handler that must satisfy the requirement so Succeed or Fail will be called no matter what.
Inheritance
System.Object
Microsoft.AspNetCore.Authorization.AuthorizationHandler<T, TResource>
Namespace: Umbraco.Cms.Web.BackOffice.Authorization
Assembly: Umbraco.Web.BackOffice.dll
Syntax
public abstract class MustSatisfyRequirementAuthorizationHandler<T, TResource> : AuthorizationHandler<T, TResource>, IAuthorizationHandler where T : IAuthorizationRequirement
Type Parameters
Name | Description |
---|---|
T | Authorization requirement. |
TResource | Resource to authorize access to. |
Remarks
aspnetcore Authz handlers are not required to satisfy the requirement and generally don't explicitly call Fail when the requirement isn't satisfied, however in many simple cases explicitly calling Succeed or Fail is what we want which is what this class is used for.
Methods
View SourceHandleRequirementAsync(AuthorizationHandlerContext, T, TResource)
Declaration
protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, T requirement, TResource resource)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Authorization.AuthorizationHandlerContext | context | |
T | requirement | |
TResource | resource |
Returns
Type | Description |
---|---|
Task |
IsAuthorized(AuthorizationHandlerContext, T, TResource)
Return true if the requirement is succeeded or ignored, return false if the requirement is explicitly not met
Declaration
protected abstract Task<bool> IsAuthorized(AuthorizationHandlerContext context, T requirement, TResource resource)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Authorization.AuthorizationHandlerContext | context | The authorization context. |
T | requirement | The authorization requirement. |
TResource | resource | The resource to authorize access to. |
Returns
Type | Description |
---|---|
Task<System.Boolean> | True if request is authorized, false if not. |