asp.net-coresaml-2.0sustainsys-saml2

Is it possible to change SAML IdentityProvider options outside of Startup.cs using Sustainsys.Saml2?


Is it possible to set IdentityProvider options (EntityId, MetadataLocation) for Saml2 outside the Startup.cs class in an ASP.NET Core application using the Sustainsys.Saml2 library?

In my scenario, different customers will require different settings, so I will need to change the settings at runtime rather than application start.


Solution

  • Yes. You can both change the settings of the IdentityProvider object as well as add new or remove old Idps from the IdentityProvider dictionary. Don't change the EntityId though as that is used as the key in the dictionary. Remove/add new instead.

    There are also notifications you can use to entirely bypass the built in list of Idps and instead use your own store or create Idp objects on-the-fly.

    If you use Metadata loading you should really cache them, as creating one with Metadata loading requires an outbound roundtrip to download metadata before it can be used.