AuthorizationServiceExtensions.AuthorizeAsync Method

Definition

Overloads

AuthorizeAsync(IAuthorizationService, ClaimsPrincipal, AuthorizationPolicy)

Checks if a user meets a specific authorization policy against the specified resource.

AuthorizeAsync(IAuthorizationService, ClaimsPrincipal, String)

Checks if a user meets a specific authorization policy against the specified resource.

AuthorizeAsync(IAuthorizationService, ClaimsPrincipal, Object, AuthorizationPolicy)

Checks if a user meets a specific authorization policy against the specified resource.

AuthorizeAsync(IAuthorizationService, ClaimsPrincipal, Object, IAuthorizationRequirement)

Checks if a user meets a specific requirement for the specified resource

AuthorizeAsync(IAuthorizationService, ClaimsPrincipal, AuthorizationPolicy)

Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs

Checks if a user meets a specific authorization policy against the specified resource.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<bool> ^ AuthorizeAsync(Microsoft::AspNetCore::Authorization::IAuthorizationService ^ service, System::Security::Claims::ClaimsPrincipal ^ user, Microsoft::AspNetCore::Authorization::AuthorizationPolicy ^ policy);
public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<Microsoft::AspNetCore::Authorization::AuthorizationResult ^> ^ AuthorizeAsync(Microsoft::AspNetCore::Authorization::IAuthorizationService ^ service, System::Security::Claims::ClaimsPrincipal ^ user, Microsoft::AspNetCore::Authorization::AuthorizationPolicy ^ policy);
public static System.Threading.Tasks.Task<bool> AuthorizeAsync (this Microsoft.AspNetCore.Authorization.IAuthorizationService service, System.Security.Claims.ClaimsPrincipal user, Microsoft.AspNetCore.Authorization.AuthorizationPolicy policy);
public static System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult> AuthorizeAsync (this Microsoft.AspNetCore.Authorization.IAuthorizationService service, System.Security.Claims.ClaimsPrincipal user, Microsoft.AspNetCore.Authorization.AuthorizationPolicy policy);
static member AuthorizeAsync : Microsoft.AspNetCore.Authorization.IAuthorizationService * System.Security.Claims.ClaimsPrincipal * Microsoft.AspNetCore.Authorization.AuthorizationPolicy -> System.Threading.Tasks.Task<bool>
static member AuthorizeAsync : Microsoft.AspNetCore.Authorization.IAuthorizationService * System.Security.Claims.ClaimsPrincipal * Microsoft.AspNetCore.Authorization.AuthorizationPolicy -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult>
<Extension()>
Public Function AuthorizeAsync (service As IAuthorizationService, user As ClaimsPrincipal, policy As AuthorizationPolicy) As Task(Of Boolean)
<Extension()>
Public Function AuthorizeAsync (service As IAuthorizationService, user As ClaimsPrincipal, policy As AuthorizationPolicy) As Task(Of AuthorizationResult)

Parameters

service
IAuthorizationService

The IAuthorizationService providing authorization.

user
ClaimsPrincipal

The user to evaluate the policy against.

policy
AuthorizationPolicy

The policy to evaluate.

Returns

A flag indicating whether policy evaluation has succeeded or failed. This value is true when the user fulfills the policy, otherwise false.

Applies to

AuthorizeAsync(IAuthorizationService, ClaimsPrincipal, String)

Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs

Checks if a user meets a specific authorization policy against the specified resource.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<bool> ^ AuthorizeAsync(Microsoft::AspNetCore::Authorization::IAuthorizationService ^ service, System::Security::Claims::ClaimsPrincipal ^ user, System::String ^ policyName);
public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<Microsoft::AspNetCore::Authorization::AuthorizationResult ^> ^ AuthorizeAsync(Microsoft::AspNetCore::Authorization::IAuthorizationService ^ service, System::Security::Claims::ClaimsPrincipal ^ user, System::String ^ policyName);
public static System.Threading.Tasks.Task<bool> AuthorizeAsync (this Microsoft.AspNetCore.Authorization.IAuthorizationService service, System.Security.Claims.ClaimsPrincipal user, string policyName);
public static System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult> AuthorizeAsync (this Microsoft.AspNetCore.Authorization.IAuthorizationService service, System.Security.Claims.ClaimsPrincipal user, string policyName);
static member AuthorizeAsync : Microsoft.AspNetCore.Authorization.IAuthorizationService * System.Security.Claims.ClaimsPrincipal * string -> System.Threading.Tasks.Task<bool>
static member AuthorizeAsync : Microsoft.AspNetCore.Authorization.IAuthorizationService * System.Security.Claims.ClaimsPrincipal * string -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult>
<Extension()>
Public Function AuthorizeAsync (service As IAuthorizationService, user As ClaimsPrincipal, policyName As String) As Task(Of Boolean)
<Extension()>
Public Function AuthorizeAsync (service As IAuthorizationService, user As ClaimsPrincipal, policyName As String) As Task(Of AuthorizationResult)

Parameters

service
IAuthorizationService

The IAuthorizationService providing authorization.

user
ClaimsPrincipal

The user to evaluate the policy against.

policyName
String

The name of the policy to evaluate.

Returns

A flag indicating whether policy evaluation has succeeded or failed. This value is true when the user fulfills the policy, otherwise false.

Applies to

AuthorizeAsync(IAuthorizationService, ClaimsPrincipal, Object, AuthorizationPolicy)

Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs

Checks if a user meets a specific authorization policy against the specified resource.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<bool> ^ AuthorizeAsync(Microsoft::AspNetCore::Authorization::IAuthorizationService ^ service, System::Security::Claims::ClaimsPrincipal ^ user, System::Object ^ resource, Microsoft::AspNetCore::Authorization::AuthorizationPolicy ^ policy);
public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<Microsoft::AspNetCore::Authorization::AuthorizationResult ^> ^ AuthorizeAsync(Microsoft::AspNetCore::Authorization::IAuthorizationService ^ service, System::Security::Claims::ClaimsPrincipal ^ user, System::Object ^ resource, Microsoft::AspNetCore::Authorization::AuthorizationPolicy ^ policy);
public static System.Threading.Tasks.Task<bool> AuthorizeAsync (this Microsoft.AspNetCore.Authorization.IAuthorizationService service, System.Security.Claims.ClaimsPrincipal user, object resource, Microsoft.AspNetCore.Authorization.AuthorizationPolicy policy);
public static System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult> AuthorizeAsync (this Microsoft.AspNetCore.Authorization.IAuthorizationService service, System.Security.Claims.ClaimsPrincipal user, object resource, Microsoft.AspNetCore.Authorization.AuthorizationPolicy policy);
public static System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult> AuthorizeAsync (this Microsoft.AspNetCore.Authorization.IAuthorizationService service, System.Security.Claims.ClaimsPrincipal user, object? resource, Microsoft.AspNetCore.Authorization.AuthorizationPolicy policy);
static member AuthorizeAsync : Microsoft.AspNetCore.Authorization.IAuthorizationService * System.Security.Claims.ClaimsPrincipal * obj * Microsoft.AspNetCore.Authorization.AuthorizationPolicy -> System.Threading.Tasks.Task<bool>
static member AuthorizeAsync : Microsoft.AspNetCore.Authorization.IAuthorizationService * System.Security.Claims.ClaimsPrincipal * obj * Microsoft.AspNetCore.Authorization.AuthorizationPolicy -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult>
<Extension()>
Public Function AuthorizeAsync (service As IAuthorizationService, user As ClaimsPrincipal, resource As Object, policy As AuthorizationPolicy) As Task(Of Boolean)
<Extension()>
Public Function AuthorizeAsync (service As IAuthorizationService, user As ClaimsPrincipal, resource As Object, policy As AuthorizationPolicy) As Task(Of AuthorizationResult)

Parameters

service
IAuthorizationService

The IAuthorizationService providing authorization.

user
ClaimsPrincipal

The user to evaluate the policy against.

resource
Object

The resource to evaluate the policy against.

policy
AuthorizationPolicy

The policy to evaluate.

Returns

A flag indicating whether policy evaluation has succeeded or failed. This value is true when the user fulfills the policy, otherwise false.

Applies to

AuthorizeAsync(IAuthorizationService, ClaimsPrincipal, Object, IAuthorizationRequirement)

Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs
Source:
AuthorizationServiceExtensions.cs

Checks if a user meets a specific requirement for the specified resource

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<bool> ^ AuthorizeAsync(Microsoft::AspNetCore::Authorization::IAuthorizationService ^ service, System::Security::Claims::ClaimsPrincipal ^ user, System::Object ^ resource, Microsoft::AspNetCore::Authorization::IAuthorizationRequirement ^ requirement);
public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<Microsoft::AspNetCore::Authorization::AuthorizationResult ^> ^ AuthorizeAsync(Microsoft::AspNetCore::Authorization::IAuthorizationService ^ service, System::Security::Claims::ClaimsPrincipal ^ user, System::Object ^ resource, Microsoft::AspNetCore::Authorization::IAuthorizationRequirement ^ requirement);
public static System.Threading.Tasks.Task<bool> AuthorizeAsync (this Microsoft.AspNetCore.Authorization.IAuthorizationService service, System.Security.Claims.ClaimsPrincipal user, object resource, Microsoft.AspNetCore.Authorization.IAuthorizationRequirement requirement);
public static System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult> AuthorizeAsync (this Microsoft.AspNetCore.Authorization.IAuthorizationService service, System.Security.Claims.ClaimsPrincipal user, object resource, Microsoft.AspNetCore.Authorization.IAuthorizationRequirement requirement);
public static System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult> AuthorizeAsync (this Microsoft.AspNetCore.Authorization.IAuthorizationService service, System.Security.Claims.ClaimsPrincipal user, object? resource, Microsoft.AspNetCore.Authorization.IAuthorizationRequirement requirement);
static member AuthorizeAsync : Microsoft.AspNetCore.Authorization.IAuthorizationService * System.Security.Claims.ClaimsPrincipal * obj * Microsoft.AspNetCore.Authorization.IAuthorizationRequirement -> System.Threading.Tasks.Task<bool>
static member AuthorizeAsync : Microsoft.AspNetCore.Authorization.IAuthorizationService * System.Security.Claims.ClaimsPrincipal * obj * Microsoft.AspNetCore.Authorization.IAuthorizationRequirement -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Authorization.AuthorizationResult>
<Extension()>
Public Function AuthorizeAsync (service As IAuthorizationService, user As ClaimsPrincipal, resource As Object, requirement As IAuthorizationRequirement) As Task(Of Boolean)
<Extension()>
Public Function AuthorizeAsync (service As IAuthorizationService, user As ClaimsPrincipal, resource As Object, requirement As IAuthorizationRequirement) As Task(Of AuthorizationResult)

Parameters

service
IAuthorizationService

The IAuthorizationService providing authorization.

user
ClaimsPrincipal

The user to evaluate the policy against.

resource
Object

The resource to evaluate the policy against.

requirement
IAuthorizationRequirement

The requirement to evaluate the policy against.

Returns

A flag indicating whether requirement evaluation has succeeded or failed. This value is true when the user fulfills the policy, otherwise false.

Applies to