IPolicyEvaluator.AuthorizeAsync Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Tente d’autoriser une stratégie à l’aide IAuthorizationServicede .
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)
Paramètres
- policy
- AuthorizationPolicy
L’AuthorizationPolicyopérateur
- authenticationResult
- AuthenticateResult
Résultat d’un appel à AuthenticateAsync(AuthorizationPolicy, HttpContext).
- context
- HttpContext
L’HttpContextopérateur
- resource
- Object
Ressource facultative avec laquelle la stratégie doit être vérifiée. Si une ressource n’est pas requise pour l’évaluation de la stratégie, vous pouvez passer null comme valeur.
Retours
Retourne Success() si l’autorisation réussit. Dans le cas contraire, retourne Forbid(AuthorizationFailure) si Succeeded, retourne Challenge()