Dela via


PolicyEvaluator.AuthorizeAsync Method

Definition

Attempts authorization for a policy using IAuthorizationService.

public:
 virtual System::Threading::Tasks::Task<Microsoft::AspNetCore::Authorization::Policy::PolicyAuthorizationResult ^> ^ AuthorizeAsync(Microsoft::AspNetCore::Authorization::AuthorizationPolicy ^ policy, Microsoft::AspNetCore::Authentication::AuthenticateResult ^ authenticationResult, Microsoft::AspNetCore::Http::HttpContext ^ context, System::Object ^ resource);
public virtual System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.Policy.PolicyAuthorizationResult> AuthorizeAsync (Microsoft.AspNetCore.Authorization.AuthorizationPolicy policy, Microsoft.AspNetCore.Authentication.AuthenticateResult authenticationResult, Microsoft.AspNetCore.Http.HttpContext context, object resource);
public virtual System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.Policy.PolicyAuthorizationResult> AuthorizeAsync (Microsoft.AspNetCore.Authorization.AuthorizationPolicy policy, Microsoft.AspNetCore.Authentication.AuthenticateResult authenticationResult, Microsoft.AspNetCore.Http.HttpContext context, object? resource);
abstract member AuthorizeAsync : Microsoft.AspNetCore.Authorization.AuthorizationPolicy * Microsoft.AspNetCore.Authentication.AuthenticateResult * Microsoft.AspNetCore.Http.HttpContext * obj -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.Policy.PolicyAuthorizationResult>
override this.AuthorizeAsync : Microsoft.AspNetCore.Authorization.AuthorizationPolicy * Microsoft.AspNetCore.Authentication.AuthenticateResult * Microsoft.AspNetCore.Http.HttpContext * obj -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.Policy.PolicyAuthorizationResult>
Public Overridable Function AuthorizeAsync (policy As AuthorizationPolicy, authenticationResult As AuthenticateResult, context As HttpContext, resource As Object) As Task(Of PolicyAuthorizationResult)

Parameters

authenticationResult
AuthenticateResult

The result of a call to AuthenticateAsync(AuthorizationPolicy, HttpContext).

context
HttpContext

The HttpContext.

resource
Object

An optional resource the policy should be checked with. If a resource is not required for policy evaluation you may pass null as the value.

Returns

Returns Success() if authorization succeeds. Otherwise returns Forbid(AuthorizationFailure) if Succeeded, otherwise returns Challenge()

Implements

Applies to