Reloading mapping rules on change?

“ComponentSpace.Saml2” Version=“2.0.3”

We want to move our MappingRules to the database. But it would be nice if the map checked on these rules every time in case we want to dynamically add a new rule.

Is this a bad idea? The mapping rules are the core foundation of the app because that is what the claims will be. That is also what clients will request via scopes.

Storing the mapping rules and the rest of the SAML configuration in a custom database is a good idea if this configuration may be edited on-the-fly.
Your application is responsible for communicating any changes to the mapping rules or other configuration to our component.

[quote]
ComponentSpace - 12/26/2017
Storing the mapping rules and the rest of the SAML configuration in a custom database is a good idea if this configuration may be edited on-the-fly.
Your application is responsible for communicating any changes to the mapping rules or other configuration to our component.
[/quote]

Is there a service registered that will let me manipulate the configuration on the fly? Maybe during services.AddSaml()? I read the docs for "Programmatically Specifying Configuration" but I don't see a way to update them after the fact unless I need to call services.Configure twice?
Are you guys using IOptionsSnapshot under the hood? https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.options.ioptionssnapshot-1?view=aspnetcore-2.0 IE if I edit the appsettings.json will it pull the latest values from the config or are the values permanent until a restart?

You use dependency injection to access the SAML configurations object.
For example:


using ComponentSpace.Saml2.Configuration;

public class SamlController : Controller
{
private readonly SamlConfigurations _samlConfigurations;

public SamlController(IOptions samlConfigurations)
{
_samlConfigurations = samlConfigurations.Value;
}

public async Task UpdateConfiguration()
{
var samlConfiguration = _samlConfigurations.Configurations.First();

// Access and update SAML configuration as required.
var partnerIdentityProviderConfiguration =
samlConfiguration.PartnerIdentityProviderConfigurations.Select(p => p.Name == “<a href=“https://ExampleIdentityProvider” );”=“”><a href=“https://ExampleIdentityProvider” );“=”“><a href=“https://ExampleIdentityProvider”);”>https://ExampleIdentityProvider");

partnerIdentityProviderConfiguration.MappingRules = new List()
{
new SamlMappingRule()
{
Rule = “Constant”,
Value = “test@user.com
}
};

return new EmptyResult();
}
}