Partager via


AuthorizationServiceClient.AuthorizeOrThrowAsync Method

Definition

Verifies that the previously authenticated user is authorized to perform some operation, or throws an exception.

public System.Threading.Tasks.Task AuthorizeOrThrowAsync (Microsoft.ServiceHub.Framework.Services.ProtectedOperation operation, System.Threading.CancellationToken cancellationToken = default);
member this.AuthorizeOrThrowAsync : Microsoft.ServiceHub.Framework.Services.ProtectedOperation * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function AuthorizeOrThrowAsync (operation As ProtectedOperation, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

operation
ProtectedOperation

The operation to check authorization for.

cancellationToken
CancellationToken

A cancellation token.

Returns

A task that completes successfully if the operation is authorized, or faults if not.

Exceptions

Thrown if the client is not authorized to perform the operation.

Applies to