Good day All,

I am using ComponentSpace as a Service Provider to establish SAML2 Single Sign On to my for my clients. The clients use their own identity providers to authenticate and gain access to my MVC5 web application. The issue I am having is that when a client wants to update their X509 certificate files I update the physical files dynamically, but I have to do an IIS reset to get the new certificate files to be used. How can I avoid having to do an IIS reset and get ComponentSpace to use the new X509 certificate files when authenticating. An example of my code is below.

var samlConfiguration = new 
ComponentSpace.SAML2.Configuration.SAMLConfiguration();

var ssoUrl = "https://www.ssoUrl/Consumer";
var ssoName ="https://www.ssoName";

var localServiceProviderConfiguration = new LocalServiceProviderConfiguration()
{
  Name = ssoName,
  AssertionConsumerServiceUrl = ssoUrl
};

samlConfiguration.LocalServiceProviderConfiguration = localServiceProviderConfiguration ;

var certNamePrimary = ConfigurationManager.AppSettings["Certificate_Path"] + "cert-A.cer";

var certNameSecondary = ConfigurationManager.AppSettings["Certificate_Path"] + "cert-B.cer";

var partnerIdentityProviderConfiguration = new 
ComponentSpace.SAML2.Configuration.PartnerIdentityProviderConfiguration()
{
    Name = clientConfig.PartnerIdPName,
    SingleSignOnServiceUrl = clientConfig.IdPSingleSignOnServiceURL,
    SignAuthnRequest = false,
    WantSAMLResponseSigned = false,
    WantAssertionEncrypted = false,
    WantAssertionSigned = true,
    PartnerCertificateFile = certNamePrimary ,
    SecondaryPartnerCertificateFile = certNameSecondary 
};

samlConfiguration.PartnerIdentityProviderConfigurations.AddPartnerIdentityProvider(partnerIdentityProviderConfiguration );

if (ComponentSpace.SAML2.SAMLController.Configurations.Keys.Contains(ssoUrl))
{
   ComponentSpace.SAML2.SAMLController.Configurations.Remove(ssoUrl);                        
   ComponentSpace.SAML2.SAMLController.Configurations.Add(ssoUrl, samlConfiguration);
}
else
    ComponentSpace.SAML2.SAMLController.Configurations.Add(ssoUrl, samlConfiguration);

ComponentSpace.SAML2.SAMLController.ConfigurationID = ssoUrl;
SAMLServiceProvider.InitiateSSO(Response, null, "http://company.com/adfs/services/trust");
0

There are 0 best solutions below