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
相关文章推荐
- Asp.Net WebApi核心对象解析(二)
- Asp.Net WebApi核心对象解析(一)
- Asp.Net WebApi核心对象解析
- AspNetCore源码解析_1_CORS中间件
- Asp.Net WebAPI核心对象解析(三)
- Asp.Net WebAPI核心对象解析(三)
- ASP.NET五大核心对象解析
- (转载)ASP.NET三大核心对象及基础功能解析
- Asp.net生成二维码和解析二维码源码
- Interger对象源码解析
- 源代码阅读方法 jQuery源码解析 核心模块core.js
- jquery源码解析----对象的创建
- JQuery源码解析-- 对象的创建
- Asp 解析 XML并分页显示源码
- 史上最全Universal-Image-Loader源码解析————核心代码篇
- jquery源码解析:val方法和valHooks对象详解
- Shiro中自定义Realm的作用(FormAuthenticationFilter和PermissionAuthorizationFilter)以及源码解析
- 像素缓冲区对象(PBO) 的Streaming-Texture上传 源码解析
- 深入理解Asp.net核心对象