共用方式為


PolicyServiceCollectionExtensions.AddAuthorization 方法

定義

多載

AddAuthorization(IServiceCollection)

將授權原則服務新增至指定的 IServiceCollection

AddAuthorization(IServiceCollection, Action<AuthorizationOptions>)

將授權原則服務新增至指定的 IServiceCollection

AddAuthorization(IServiceCollection)

來源:
PolicyServiceCollectionExtensions.cs

將授權原則服務新增至指定的 IServiceCollection

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddAuthorization (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
static member AddAuthorization : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddAuthorization (services As IServiceCollection) As IServiceCollection

參數

services
IServiceCollection

要新增服務的 IServiceCollection

傳回

IServiceCollection,以便鏈結其他呼叫。

適用於

AddAuthorization(IServiceCollection, Action<AuthorizationOptions>)

來源:
PolicyServiceCollectionExtensions.cs

將授權原則服務新增至指定的 IServiceCollection

public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddAuthorization (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.AspNetCore.Authorization.AuthorizationOptions> configure);
static member AddAuthorization : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<Microsoft.AspNetCore.Authorization.AuthorizationOptions> -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddAuthorization (services As IServiceCollection, configure As Action(Of AuthorizationOptions)) As IServiceCollection

參數

services
IServiceCollection

要新增服務的 IServiceCollection

configure
Action<AuthorizationOptions>

要設定所提供 AuthorizationOptions 之 的動作委派。

傳回

IServiceCollection,以便鏈結其他呼叫。

適用於