Sdílet prostřednictvím


PolicyEvaluator.AuthorizeAsync Metoda

Definice

Pokusí se o autorizaci zásad pomocí 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)

Parametry

authenticationResult
AuthenticateResult

Výsledek volání AuthenticateAsync(AuthorizationPolicy, HttpContext)metody .

context
HttpContext

Hodnota HttpContext

resource
Object

Volitelný prostředek, se kterým by se zásady měly zkontrolovat. Pokud se prostředek pro vyhodnocení zásad nevyžaduje, můžete jako hodnotu předat hodnotu null.

Návraty

Pokud je autorizace úspěšná, vrátí hodnotu Success() . V opačném případě vrátí Forbid(AuthorizationFailure) hodnotu , Succeededjinak vrátí hodnotu . Challenge()

Implementuje

Platí pro