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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

holdengong   2020-03-18 我要评论
# 系列文章目录 - [AspNetCore3.1_Secutiry源码解析_1_目录](https://holdengong.com/aspnetcore3.1_secutiry源码解析_1_目录) - [AspNetCore3.1_Secutiry源码解析_2_Authentication_核心项目](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

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们