How to redirect to Microsoft Login page from Asp.Net Core using Azure SAML2 Auth

352 views Asked by At

I am using Azure SAML2 SSO Auth in .Net core application. My problem is that the application is not redirecting to the Microsoft login page for Authentication.

Startup.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();
0

There are 0 answers