0

We have an asp.net core website that configures a bunch of database setups for SSO that are OpenId and Saml2 endpoints. These change or are added in a UI for Administrators as necessary.

Right now we have to recycle the app pool to update these because they're created and updated in the Startup.cs from the database.

I'm trying to find a way to be able to do CRUD on these at runtime but I can't find any documentation on how to get the AuthenticationBuilder and even if I could get it with injection, I can't find anything that would allow me to remove or edit existing ones, only add.

Anyone know how to get at this information ad update these dynamically at runtime?

James Hancock
  • 3,348
  • 5
  • 34
  • 59
  • 1
    Do I understand you correctly that you're trying to add/remove SAML and OpenID endpoints dynamically at runtime, in what I would assume is a kind of multi-tenant application? – Wim Ombelets Nov 20 '18 at 12:29
  • That's right. Also need to be able to edit them in case a setting doesn't work, but of course we could remove and then add again if that's the only way. – James Hancock Nov 20 '18 at 12:32
  • I won't add this as an answer because I don't want to take credit for someone else's work but have a look at Generic and Dynamic Controllers in asp.net core mvc - https://www.strathweb.com/2018/04/generic-and-dynamically-generated-controllers-in-asp-net-core-mvc/ as I believe it could solve your problem or at least point you in a possible direction. – Wim Ombelets Nov 20 '18 at 12:34
  • Sorry, not sure how this helps. We use generic controllers extensively, but the oidc and saml2 support is a configuration option. I need to get at the configuration data and be able to add and remove them from my controllers instead of at startup. I can't find any methods that allow me to do so, or any way to get at the collection either. – James Hancock Nov 20 '18 at 12:44
  • So you're trying to limit what kind of protocols to allow for a particular tenant at runtime? – Wim Ombelets Nov 20 '18 at 12:50
  • I have a database that stores all of the configuration for each tenant's sso provider. At startup I query the db and call the right addxxx commands. I need to be able to do this in a controller endpoint too so the API doesn't have to be restarted when a change occurs (CRUD) – James Hancock Nov 20 '18 at 13:52

0 Answers0