c# - AAD 身份验证和 cookie 名称?
问题描述
我正在使用 ASP.Net Core 2.2 MVC。
我的启动添加了 AddAuthentication
我希望能够配置存储 AAD 令牌的 cookie。我尝试在下面添加此代码。但是当我在 Chrome 中运行我的应用程序时,我在开发工具中看不到 cookie 名称。有任何想法吗?
services.ConfigureApplicationCookie(options =>
{
options.Cookie.Name = "MeAPP";
options.ExpireTimeSpan = TimeSpan.FromMinutes(60);
options.SlidingExpiration = true;
});
解决方案
您可以通过以下方式重命名 cookie 名称:
services.AddAuthentication(AzureADDefaults.AuthenticationScheme)
.AddAzureAD(options => Configuration.Bind("AzureAd", options));
services.Configure<CookieAuthenticationOptions>(AzureADDefaults.CookieScheme, options =>
{
options.Cookie.Name = "MyCookieName";
});
推荐阅读
- android - 您是否在 AndroidManifest.xml 中声明了此活动?(安卓工作室)2018
- javascript - 选择边框不正确,而画布的缩放值不是 1
- python - 找不到模块 qiskit_aqua.algorithms
- javascript - 从重复数组填充数组
- sql - 超过 2 个表的 SQL 查询
- vue.js - 简写的 ES6 方法语法是否也适用于 ES5?
- c# - 使用滑动效果展开和折叠画布 - UWP C#
- c# - 并行枚举目录消耗非常高的物理内存使用率
- wordpress - 如何解决被黑的网站?Webshell wordpress 网站
- python - MailChimp API | Python 外壳 | 使用 openDate、clickDate 和用户电子邮件获取用户活动列表