Sustainsys / Saml2

Saml2 Authentication services for ASP.NET
Other
961 stars 603 forks source link

OKTA Metadata #1315

Closed mjorrens1 closed 3 years ago

mjorrens1 commented 3 years ago

I have a test application working with Saml2.AspNetCore2 (2.8.0).

Everything works fine with

    options.IdentityProviders.Add(
        new IdentityProvider(
            new EntityId("https://stubidp.sustainsys.com/Metadata"), options.SPOptions) 
        {
            LoadMetadata = true
        });

When I try the OKTA metadata (you can go to theURL to see the metadata provided)

    options.IdentityProviders.Add(
        new IdentityProvider(
            new EntityId("https://dev-60124262.okta.com/app/exk2edycw57Obmc5i5d7/sso/saml/metadata"), options.SPOptions) 
        {
            LoadMetadata = true
        });

I get this error: System.Configuration.ConfigurationErrorsException: 'Unexpected entity id "http://www.okta.com/exk2edycw57Obmc5i5d7" found when loading metadata for "https://dev-60124262.okta.com/app/exk2edycw57Obmc5i5d7/sso/saml/metadata".'

Is there a problem with how the XML is formed or perhaps some type of parsing issue?

explunit commented 3 years ago

Try setting the MetadataLocation property as well as specifying the actual entity id (not the url). I think that might be required in the cases where the Entity ID differs from the Metadata URL.

mjorrens1 commented 3 years ago

Thanks! That was the problem.