学习009-07 Authenticate and Authorize Web API Endpoints(对 Web API 端点进行身份验证和授权 )

Authenticate and Authorize Web API Endpoints(对 Web API 端点进行身份验证和授权 )

The Web API supports all standard ASP.NET Core authentication techniques that you can specify in the MySolution.WebApi\Startup.cs (MySolution.Blazor.Server\Startup.cs) file. See the following topic for more information: Authentication.
Web API支持可以在MySolutions. WebApi\Startup.cs(MySolutions.Blazor.Server\Startup.cs)文件中指定的所有标准ASP.NET核心身份验证技术。有关详细信息,请参阅以下主题:身份验证。

If you use the Solution Wizard to create a Web API project, enable authentication on the Choose Security page:
如果您使用解决方案向导创建Web API项目,请在选择安全页面上启用身份验证:
在这里插入图片描述

Standard Authentication(标准认证)

The wizard generates JWT authentication scaffolding code for the Web API.
该向导为Web API生成JWT身份验证脚手架代码。

OAuth2 Authentication(OAuth2认证)

The wizard adds the JWT and Azure AD scaffolding code to the MySolution.WebApi\appsettings.json file.
该向导将JWT和Azure AD脚手架代码添加到MySolutions. WebApi\appset.json文件中。

Windows Active Directory(Windows活动目录)

The wizard adds the JWT scaffolding code to the MySolution.WebApi\appsettings.json file and the scaffolding code for Windows Active Directory to the MySolution.WebApi\Properties\launchSettings.json file.
该向导将JWT脚手架代码添加到MySolutions. WebApi\appsetings.json文件中,并将Windows Active Directory的脚手架代码添加到MySolutions.WebApi\Properties\LaunchSetings.json文件中。

See the following topics for information on how to configure the authentication scaffolding code and manually enable authentication:
有关如何配置身份验证脚手架代码和手动启用身份验证的信息,请参阅以下主题:

  • Configure the JWT Authentication(配置JWT身份验证)
  • Configure the OAuth2 Azure Authentication(配置OAuth2 Azure身份验证)

Configure Authorization for Endpoints or Protect Business Object Data(为端点配置授权或保护业务对象数据)

You must define Security System permissions for business objects and properties you want to expose through a Web API Service (both built-in and custom endpoints). We do not recommend that you expose business object data to all users without security protection.
您必须为要通过Web API服务(内置和自定义终结点)公开的业务对象和属性定义安全系统权限。我们不建议您在没有安全保护的情况下向所有用户公开业务对象数据。

You can configure permissions using one of the following methods:
您可以使用以下方法之一配置权限:

  • In the code of the ModuleUpdater class (look for the Updater.cs file, because there may be different locations depending on your project configuration).(在ModuleUpdater类的代码中(查找Updater. cs文件,因为根据您的项目配置可能有不同的位置)。)
  • In the administrative UI powered by XAF Blazor/WinForms (this feature requires the Universal license).(在由XAF Blazor/WinForms提供支持的管理UI中(此功能需要通用许可证)。)

For more information, refer to the following concepts and examples:
有关详细信息,请参阅以下概念和示例:

  • Create Predefined Users, Roles and Permissions in the Database(在数据库中创建预定义的用户、角色和权限)
  • How to restrict inter-departmental data access using Security Permissions (EF Core)(如何使用安全权限(EF Core)限制部门间数据访问)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

汤姆•猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值