共用方式為


AuthorizationBuilder.SetFallbackPolicy(AuthorizationPolicy) 方法

定義

設定未提供 IAuthorizeData 時所使用的 CombineAsync(IAuthorizationPolicyProvider, IEnumerable<IAuthorizeData>) 後援授權原則。 因此,如果資源沒有 IAuthorizeData 實例,AuthorizationMiddleware 就會使用後援原則。 如果資源有任何 IAuthorizeData 資源,則會進行評估,而不是後援原則。 根據預設,後援原則為 Null,除非您在管線中有 AuthorizationMiddleware,否則通常不會有任何作用。 預設 IAuthorizationService 不會以任何方式使用它。

public virtual Microsoft.AspNetCore.Authorization.AuthorizationBuilder SetFallbackPolicy (Microsoft.AspNetCore.Authorization.AuthorizationPolicy? policy);
abstract member SetFallbackPolicy : Microsoft.AspNetCore.Authorization.AuthorizationPolicy -> Microsoft.AspNetCore.Authorization.AuthorizationBuilder
override this.SetFallbackPolicy : Microsoft.AspNetCore.Authorization.AuthorizationPolicy -> Microsoft.AspNetCore.Authorization.AuthorizationBuilder
Public Overridable Function SetFallbackPolicy (policy As AuthorizationPolicy) As AuthorizationBuilder

參數

傳回

產生器。

適用於