AuthorizationAppBuilderExtensions.UseAuthorization(IApplicationBuilder) 方法

定义

将添加 AuthorizationMiddleware 到指定的 IApplicationBuilder ,这将启用授权功能。

在授权使用终结点路由路由的资源时,此调用必须出现在对应用的调用之间 。UseRouting () 应用程序。UseEndpoints ( ) ,中间件可以正常工作。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IApplicationBuilder ^ UseAuthorization(Microsoft::AspNetCore::Builder::IApplicationBuilder ^ app);
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseAuthorization (this Microsoft.AspNetCore.Builder.IApplicationBuilder app);
static member UseAuthorization : Microsoft.AspNetCore.Builder.IApplicationBuilder -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function UseAuthorization (app As IApplicationBuilder) As IApplicationBuilder

参数

app
IApplicationBuilder

IApplicationBuilder 将中间件添加到其中的。

返回

IApplicationBuilder

app完成操作后对的引用。

适用于