首页 > 解决方案 > 如何使用 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();

标签: .netasp.net-core-mvcsingle-sign-onsustainsys-saml2

解决方案


推荐阅读