Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configuring mulitple Azure Entra Id Saml2 based IdP's in in middleware, and attempting to invoke chosesn IdP in the Acs Challange, I get the following exception #1480

Open
joshuafranklinengineeringsystems opened this issue Dec 3, 2024 · 2 comments

Comments

@joshuafranklinengineeringsystems
Copy link

joshuafranklinengineeringsystems commented Dec 3, 2024

My code works perfeclty fine if I enable one or the other IdP's but when I enabled them both at the same time I get the following internal execption:

System.Collections.Generic.KeyNotFoundException: No Idp with entity id "https://sts.windows.net/8c47ef63-1296-4e7a-97b7-649f4eb09330/" found.
---> System.Collections.Generic.KeyNotFoundException: The given key 'Sustainsys.Saml2.Metadata.EntityId' was not present in the dictionary.
at System.Collections.Generic.Dictionary2.get_Item(TKey key) at Sustainsys.Saml2.Configuration.IdentityProviderDictionary.get_Item(EntityId entityId) --- End of inner exception stack trace --- at Sustainsys.Saml2.Configuration.IdentityProviderDictionary.get_Item(EntityId entityId) at Sustainsys.Saml2.Configuration.Saml2Notifications.<>c.<.ctor>b__84_18(EntityId ei, IDictionary2 rd, IOptions opt)
at Sustainsys.Saml2.WebSso.AcsCommand.GetIdpContext(XmlElement xml, HttpRequestData request, IOptions options)
at Sustainsys.Saml2.WebSso.AcsCommand.Run(HttpRequestData request, IOptions options)
at Sustainsys.Saml2.AspNetCore2.Saml2Handler.HandleRequestAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

Part of the middleware, that iterates over a look of 1 to n IdP's from appsetting.json.

@joshuafranklinengineeringsystems joshuafranklinengineeringsystems changed the title configuring mulitple IdP's in in middleware, and attempting to invoke chosesn IdP in the Acs Challange, I get the following exception configuring mulitple Entra Id Saml2 based IdP's in in middleware, and attempting to invoke chosesn IdP in the Acs Challange, I get the following exception Dec 3, 2024
@joshuafranklinengineeringsystems joshuafranklinengineeringsystems changed the title configuring mulitple Entra Id Saml2 based IdP's in in middleware, and attempting to invoke chosesn IdP in the Acs Challange, I get the following exception configuring mulitple Azure Entra Id Saml2 based IdP's in in middleware, and attempting to invoke chosesn IdP in the Acs Challange, I get the following exception Dec 3, 2024
@rikrak
Copy link

rikrak commented Jan 10, 2025

Could it be a case-sensitivity issue? I think the Idp identifiers are case-sensitive
Can you share the relevant parts of your appsettings.json?

@joshuafranklinengineeringsystems
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants