.net - 如何使用 Azure SAML2 Auth 从 Asp.Net Core 重定向到 Microsoft 登录页面
问题描述
我在 .Net 核心应用程序中使用 Azure SAML2 SSO Auth。我的问题是应用程序没有重定向到 Microsoft 登录页面进行身份验证。
启动.cs
services.AddControllersWithViews();
services.AddAuthentication(sharedOptions =>
{
sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
sharedOptions.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
sharedOptions.DefaultChallengeScheme = "Saml2";
})
.AddSaml2(options =>
{
options.SPOptions.EntityId = new EntityId("https://localhost:44378");
options.IdentityProviders.Add(
new IdentityProvider(
new EntityId("https://sts.windows.net/9e5692e4-bd0a-4148-8b61-98f59dab156e/"), options.SPOptions)
{
MetadataLocation = "https://login.microsoftonline.com/9e5692e4-bd0a-4148-8b61-98f59dab156e/federationmetadata/2007-06/federationmetadata.xml?appid=1729db2f-0156-41cb-b4e3-d54bed555b85"
});
})
.AddCookie();
解决方案
推荐阅读
- spring - 使用 Junit 和 Mockito 嵌套异常问题测试 POST Api
- python - Scrapy & Selenium:如何在循环中调用方法
- design-patterns - 如何使用可更新缓存实现存储库模式
- angular - 带有辅助路线的 Angular 6 材质选项卡导航
- mongodb - 如何在开始测试之前删除 mongodb 中的所有模型并注册用户?
- java - 什么是@constructorproperties?这是属于 J2SE 还是 Spring?
- java - HTTP 500 内部服务器错误:在容器化我的 Java Web 应用程序时
- templates - 更改 svelte 模板的默认位置
- javascript - 如何在同一个文本框中输入日期和文本
- r - 建立一个虚假的课程目录