Condividi tramite


AuthorizationServiceExtensions.AuthorizeOrThrowAsync Method

Definition

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

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task ^ AuthorizeOrThrowAsync(Microsoft::ServiceHub::Framework::Services::IAuthorizationService ^ authorizationService, Microsoft::ServiceHub::Framework::Services::ProtectedOperation ^ operation, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task AuthorizeOrThrowAsync (this Microsoft.ServiceHub.Framework.Services.IAuthorizationService authorizationService, Microsoft.ServiceHub.Framework.Services.ProtectedOperation operation, System.Threading.CancellationToken cancellationToken);
static member AuthorizeOrThrowAsync : Microsoft.ServiceHub.Framework.Services.IAuthorizationService * Microsoft.ServiceHub.Framework.Services.ProtectedOperation * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function AuthorizeOrThrowAsync (authorizationService As IAuthorizationService, operation As ProtectedOperation, cancellationToken As CancellationToken) As Task

Parameters

authorizationService
IAuthorizationService

The authorization service.

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