Sdílet prostřednictvím


IPolicyEvaluator.AuthorizeAsync Metoda

Definice

Pokusí se o autorizaci zásad pomocí IAuthorizationService.

public:
 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 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 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>
Public 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)příkazu .

context
HttpContext

Hodnota HttpContext

resource
Object

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

Návraty

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

Platí pro