Sustainsys / Saml2

Saml2 Authentication services for ASP.NET
Other
945 stars 605 forks source link

Multi tenant configuration in asp.net core #1401

Closed impathan closed 11 months ago

impathan commented 12 months ago

I have multi tenant application and having multiple azure account for different company and saml configuration. I have hosted angular application on different domain but the backend asp.net core application in single domain. I want to configure multiple saml configuration based on domain which is configured in tenant based on company.

Can we setup the saml configuration on login request based on the requested domain instead of having the saml configuration in startup class?

AndersAbel commented 11 months ago

Yes. Use the SelectIdentityProvider notification. If you have a limited number of IdentityProviders, I suggest adding all of them to the IdentityProviders collection and let SelectIdentityProvider pick the right one. If you have many of them, you can store them in a DB. Then you also need to override GetIdentityProvider

impathan commented 11 months ago

Thanks for the reply. Is any sample code available to use the SelectIdentityProvider?

AndersAbel commented 11 months ago

No, there is unfortunately not any sample available for that currently.