共用方式為


IAuthorizationService.AuthorizeAsync 方法

定義

多載

AuthorizeAsync(ClaimsPrincipal, Object, IEnumerable<IAuthorizationRequirement>)

檢查使用者是否符合指定資源的特定需求集

AuthorizeAsync(ClaimsPrincipal, Object, String)

檢查使用者是否符合特定授權原則

AuthorizeAsync(ClaimsPrincipal, Object, IEnumerable<IAuthorizationRequirement>)

來源:
IAuthorizationService.cs
來源:
IAuthorizationService.cs
來源:
IAuthorizationService.cs
來源:
IAuthorizationService.cs

檢查使用者是否符合指定資源的特定需求集

public:
 System::Threading::Tasks::Task<bool> ^ AuthorizeAsync(System::Security::Claims::ClaimsPrincipal ^ user, System::Object ^ resource, System::Collections::Generic::IEnumerable<Microsoft::AspNetCore::Authorization::IAuthorizationRequirement ^> ^ requirements);
public:
 System::Threading::Tasks::Task<Microsoft::AspNetCore::Authorization::AuthorizationResult ^> ^ AuthorizeAsync(System::Security::Claims::ClaimsPrincipal ^ user, System::Object ^ resource, System::Collections::Generic::IEnumerable<Microsoft::AspNetCore::Authorization::IAuthorizationRequirement ^> ^ requirements);
public System.Threading.Tasks.Task<bool> AuthorizeAsync (System.Security.Claims.ClaimsPrincipal user, object resource, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Authorization.IAuthorizationRequirement> requirements);
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult> AuthorizeAsync (System.Security.Claims.ClaimsPrincipal user, object resource, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Authorization.IAuthorizationRequirement> requirements);
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult> AuthorizeAsync (System.Security.Claims.ClaimsPrincipal user, object? resource, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Authorization.IAuthorizationRequirement> requirements);
abstract member AuthorizeAsync : System.Security.Claims.ClaimsPrincipal * obj * seq<Microsoft.AspNetCore.Authorization.IAuthorizationRequirement> -> System.Threading.Tasks.Task<bool>
abstract member AuthorizeAsync : System.Security.Claims.ClaimsPrincipal * obj * seq<Microsoft.AspNetCore.Authorization.IAuthorizationRequirement> -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult>
Public Function AuthorizeAsync (user As ClaimsPrincipal, resource As Object, requirements As IEnumerable(Of IAuthorizationRequirement)) As Task(Of Boolean)
Public Function AuthorizeAsync (user As ClaimsPrincipal, resource As Object, requirements As IEnumerable(Of IAuthorizationRequirement)) As Task(Of AuthorizationResult)

參數

user
ClaimsPrincipal

要評估需求的使用者。

resource
Object

應檢查原則的選擇性資源。 如果原則評估不需要資源,您可以傳遞 Null 做為值。

requirements
IEnumerable<IAuthorizationRequirement>

要評估的需求。

傳回

旗標,指出授權是否成功。 當使用者完成原則時,此值 true;否則 false

備註

資源是選擇性參數,而且可能是 Null。 請先確定在對它採取行動之前,檢查它不是 Null。

適用於

AuthorizeAsync(ClaimsPrincipal, Object, String)

來源:
IAuthorizationService.cs
來源:
IAuthorizationService.cs
來源:
IAuthorizationService.cs
來源:
IAuthorizationService.cs

檢查使用者是否符合特定授權原則

public:
 System::Threading::Tasks::Task<bool> ^ AuthorizeAsync(System::Security::Claims::ClaimsPrincipal ^ user, System::Object ^ resource, System::String ^ policyName);
public:
 System::Threading::Tasks::Task<Microsoft::AspNetCore::Authorization::AuthorizationResult ^> ^ AuthorizeAsync(System::Security::Claims::ClaimsPrincipal ^ user, System::Object ^ resource, System::String ^ policyName);
public System.Threading.Tasks.Task<bool> AuthorizeAsync (System.Security.Claims.ClaimsPrincipal user, object resource, string policyName);
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult> AuthorizeAsync (System.Security.Claims.ClaimsPrincipal user, object resource, string policyName);
public System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult> AuthorizeAsync (System.Security.Claims.ClaimsPrincipal user, object? resource, string policyName);
abstract member AuthorizeAsync : System.Security.Claims.ClaimsPrincipal * obj * string -> System.Threading.Tasks.Task<bool>
abstract member AuthorizeAsync : System.Security.Claims.ClaimsPrincipal * obj * string -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult>
Public Function AuthorizeAsync (user As ClaimsPrincipal, resource As Object, policyName As String) As Task(Of Boolean)
Public Function AuthorizeAsync (user As ClaimsPrincipal, resource As Object, policyName As String) As Task(Of AuthorizationResult)

參數

user
ClaimsPrincipal

要檢查原則的使用者。

resource
Object

應檢查原則的選擇性資源。 如果原則評估不需要資源,您可以傳遞 Null 做為值。

policyName
String

要針對特定內容檢查的原則名稱。

傳回

旗標,指出授權是否成功。 傳回旗標,指出使用者和選擇性資源是否已完成原則。 true 原則完成時:否則 false

備註

資源是選擇性參數,而且可能是 Null。 請先確定在對它採取行動之前,檢查它不是 Null。

適用於