您的位置:首页 > 编程语言 > ASP

AspNetCore3.1_Secutiry源码解析_2_Authentication_核心对象

2020-03-18 22:58 841 查看
--- title: "AspNetCore3.1_Secutiry源码解析_2_Authentication_核心流程" date: 2020-03-18T21:19:15+08:00 draft: false --- # 系列文章目录 - [AspNetCore3.1_Secutiry源码解析_1_目录](https://holdengong.com/aspnetcore3.1_secutiry源码解析_1_目录) - [AspNetCore3.1_Secutiry源码解析_2_Authentication_核心项目](https://holdengong.com/aspnetcore3.1_secutiry源码解析_2_authentication_核心流程) - AspNetCore3.1_Secutiry源码解析_3_Authentication_Cookies - AspNetCore3.1_Secutiry源码解析_4_Authentication_JwtBear - AspNetCore3.1_Secutiry源码解析_5_Authentication_OAuth - AspNetCore3.1_Secutiry源码解析_6_Authentication_OpenIdConnect - AspNetCore3.1_Secutiry源码解析_7_Authentication_其他 - AspNetCore3.1_Secutiry源码解析_8_Authorization_核心项目 - AspNetCore3.1_Secutiry源码解析_9_Authorization_Policy # 依赖注入 框架提供了三个依赖注入重载方法。 ```csharp //注入认证服务 services.AddAuthentication(); //注入认证服务并制定默认架构名 services.AddAuthentication("Cookies"); //注入认证服务并设置配置项 services.AddAuthentication(config => { }); ``` 看看注入代码 ```csharp public static AuthenticationBuilder AddAuthentication(this IServiceCollection services) { if (services == null) { throw new ArgumentNullException(nameof(services)); } services.AddAuthenticationCore(); services.AddDataProtection(); services.AddWebEncoders(); services.TryAddSingleton
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: