ComponentSpace

Forums



Reloading mapping rules on change?


Reloading mapping rules on change?

Author
Message
Tory001C
Tory001C
New Member
New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)

Group: Forum Members
Posts: 11, Visits: 44
"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. 
ComponentSpace
ComponentSpace
ComponentSpace Development
ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)

Group: Administrators
Posts: 3.2K, Visits: 11K
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.

Regards
ComponentSpace Development
Tory001C
Tory001C
New Member
New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)New Member (19 reputation)

Group: Forum Members
Posts: 11, Visits: 44
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.

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?
ComponentSpace
ComponentSpace
ComponentSpace Development
ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)ComponentSpace Development (4.4K reputation)

Group: Administrators
Posts: 3.2K, Visits: 11K
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 = samlConfigurations.Value;
  }

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

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

   partnerIdentityProviderConfiguration.MappingRules = new List<SamlMappingRule>()
   {
       new SamlMappingRule()
       {
           Rule = "Constant",
           Value = "[email protected]"
       }
   };

    return new EmptyResult();
  }
}





Regards
ComponentSpace Development
GO


Similar Topics


Execution: 0.000. 2 queries. Compression Enabled.
Login
Existing Account
Email Address:


Password:


Select a Forum....












Forums, Documentation & Knowledge Base - ComponentSpace


Search