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

参数

返回

生成器。

适用于