共用方式為


AuthorizationBuilder.AddPolicy 方法

定義

多載

AddPolicy(String, AuthorizationPolicy)

AuthorizationPolicy加入 可供 使用的 IAuthorizationService

AddPolicy(String, Action<AuthorizationPolicyBuilder>)

新增從具有所提供名稱的委派所建置的原則。

AddPolicy(String, AuthorizationPolicy)

來源:
AuthorizationBuilder.cs
來源:
AuthorizationBuilder.cs
來源:
AuthorizationBuilder.cs

AuthorizationPolicy加入 可供 使用的 IAuthorizationService

public virtual Microsoft.AspNetCore.Authorization.AuthorizationBuilder AddPolicy (string name, Microsoft.AspNetCore.Authorization.AuthorizationPolicy policy);
abstract member AddPolicy : string * Microsoft.AspNetCore.Authorization.AuthorizationPolicy -> Microsoft.AspNetCore.Authorization.AuthorizationBuilder
override this.AddPolicy : string * Microsoft.AspNetCore.Authorization.AuthorizationPolicy -> Microsoft.AspNetCore.Authorization.AuthorizationBuilder
Public Overridable Function AddPolicy (name As String, policy As AuthorizationPolicy) As AuthorizationBuilder

參數

name
String

此原則的名稱。

傳回

產生器。

適用於

AddPolicy(String, Action<AuthorizationPolicyBuilder>)

來源:
AuthorizationBuilder.cs
來源:
AuthorizationBuilder.cs
來源:
AuthorizationBuilder.cs

新增從具有所提供名稱的委派所建置的原則。

public virtual Microsoft.AspNetCore.Authorization.AuthorizationBuilder AddPolicy (string name, Action<Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder> configurePolicy);
abstract member AddPolicy : string * Action<Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder> -> Microsoft.AspNetCore.Authorization.AuthorizationBuilder
override this.AddPolicy : string * Action<Microsoft.AspNetCore.Authorization.AuthorizationPolicyBuilder> -> Microsoft.AspNetCore.Authorization.AuthorizationBuilder
Public Overridable Function AddPolicy (name As String, configurePolicy As Action(Of AuthorizationPolicyBuilder)) As AuthorizationBuilder

參數

name
String

原則的名稱。

configurePolicy
Action<AuthorizationPolicyBuilder>

將用來建置原則的委派。

傳回

產生器。

適用於