How to 'refresh' SAML configuration stored in 'SAMLController.Configurations' added via 'AddConfiguration' ?

Hello,

We have multi tenanted system and we load configuration from DB when user access SSO/{tenantId}. We store tenantId as samlConfiguration.ID when User access SSO/{tenantId} as we dont want to load everything at same time in Global.asax. Couple of questions we have,
1. We see multiple configurations in SAMLController.Configurations with same ID. Let’s say 5 Users has accessed SSO/{tenantId} with same tenantId, We see 5 entries in SAMLController.Configurations with same id. We were under the impression that it should overwrite configuration if ID exists. So need to understand why that’s the case?
2. How do we refresh those configurations in ‘SAMLController.Configurations’ when configuration changes for that tenantId without restarting server?

Thanks in advance!

If you’re refreshing a SAML configuration you should call SAMLController.Configurations.RemoveConfiguration before calling SAMLController.Configurations.AddConfiguration.

Alternatively, simply access the configuration in questions using SAMLController.Configurations.GetConfiguration and update it as required. We return a reference rather than a copy of the configuration so any changes that are made are picked up immediately.

Changes to SAMLController.Configurations don’t require restarting the server.

[quote]
ComponentSpace - 4/3/2020
If you're refreshing a SAML configuration you should call SAMLController.Configurations.RemoveConfiguration before calling SAMLController.Configurations.AddConfiguration.

Alternatively, simply access the configuration in questions using SAMLController.Configurations.GetConfiguration and update it as required. We return a reference rather than a copy of the configuration so any changes that are made are picked up immediately.

Changes to SAMLController.Configurations don't require restarting the server.
[/quote]

Thanks for the quick reply. Appreciate this.

For now I am looping through SAMLController.Configurations.Configurations and comparing the ID with updated SAMLConfiguration Id, if matches then calling Remove and adding back with Add. First I tried using SAMLController.Configurations.Configurations.Contains but somehow not getting expected results so swtiched to foreach.

Also, I tried SAMLController.Configurations.GetConfiguration to check whether configuration exists or not but if getting Exception if not found. So I am avoiding that and kind of sticking to above solution. But not liking this 'hard' refresh of removing and adding configurations :)

Thanks!

Another option is to implement the ISAMLConfigurationResolver interface rather than manipulating SAMLController.Configurations.

This approach is documented in our Configuration Guide.

https://www.componentspace.com/Forums/9350/Configuration-Guide

[quote]
ComponentSpace - 4/3/2020
Another option is to implement the ISAMLConfigurationResolver interface rather than manipulating SAMLController.Configurations.

This approach is documented in our Configuration Guide.

https://www.componentspace.com/Forums/9350/Configuration-Guide
[/quote]

Yea I am looking into that also but in that we have to change most of the current implementation so weighing my options here :) Thanks for the help!

You’re very welcome.