Example #1
0
        private static void ConfigureIdentityProvidersUsingRepository(
            SAMLConfiguration samlConfiguration,
            SamlIdentityProvidersRepository repository)
        {
            SamlPocTraceListener.Log("SAML", "SamlConfigurationManager.ConfigureIdentityProvidersUsingRepository: Loading Identity Providers");

            var providers = repository.GetRegisteredIdentityProviders();

            SamlPocTraceListener.Log("SAML", $"SamlConfigurationManager.ConfigureIdentityProvidersUsingRepository: {providers.Count()} Identity Providers loaded:");

            var providersConfig = Utils.SerializeToJson(providers);

            SamlPocTraceListener.Log("SAML", $"SamlConfigurationManager.ConfigureIdentityProvidersUsingRepository: Identity Providers configuration:\r\n{providersConfig}");

            foreach (var provider in providers)
            {
                samlConfiguration.AddPartnerIdentityProvider(
                    new PartnerIdentityProviderConfiguration()
                {
                    Name                   = provider.Name,
                    Description            = provider.Description,
                    SignAuthnRequest       = provider.SignAuthnRequest,
                    SingleSignOnServiceUrl = provider.SingleSignOnUrl,
                    SingleLogoutServiceUrl = provider.SingleLogoutUrl,
                    PartnerCertificateFile = provider.CertificateFile,
                    UseEmbeddedCertificate = provider.UseEmbeddedCertificate,
                    DisableInboundLogout   = !provider.SingleLogoutSupported,
                    DisableOutboundLogout  = !provider.SingleLogoutSupported
                });
            }
        }
Example #2
0
        public static void Configure(SamlIdentityProvidersRepository repository)
        {
            SamlPocTraceListener.Log("SAML", $"SamlConfigurationManager.Configure: Starting configuration of SAML environment.");

            SAMLConfiguration samlConfiguration = new SAMLConfiguration();

            ConfigureServiceProvider(samlConfiguration);

            ConfigureIdentityProvidersUsingRepository(samlConfiguration, repository);
            // ConfigureIdentityProvidersUsingHardCodedConfiguration(samlConfiguration);

            SAMLController.Configuration = samlConfiguration;

            SamlPocTraceListener.Log("SAML", $"SamlConfigurationManager.Configure: Ended configuration of SAML environment.");
        }