Class AuthorizationServiceExtensions
- Namespace
- Microsoft.ServiceHub.Framework.Services
- Assembly
- Microsoft.ServiceHub.Framework.dll
Extension methods for the IAuthorizationService.
public static class AuthorizationServiceExtensions
- Inheritance
-
AuthorizationServiceExtensions
- Inherited Members
Methods
AuthorizeOrThrowAsync(IAuthorizationService, ProtectedOperation, CancellationToken)
Verifies that the previously authenticated user is authorized to perform some operation, or throws an exception.
public static Task AuthorizeOrThrowAsync(this IAuthorizationService authorizationService, ProtectedOperation operation, CancellationToken cancellationToken)
Parameters
authorizationServiceIAuthorizationServiceThe authorization service.
operationProtectedOperationThe operation to check authorization for.
cancellationTokenCancellationTokenA cancellation token.
Returns
- Task
A task that completes successfully if the operation is authorized, or faults if not.
Exceptions
- UnauthorizedAccessException
Thrown if the client is not authorized to perform the
operation.