Beispiel #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
                });
            }
        }
Beispiel #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.");
        }
Beispiel #3
0
        private static void ConfigureServiceProvider(SAMLConfiguration samlConfiguration)
        {
            samlConfiguration.LocalServiceProviderConfiguration = new
                                                                  LocalServiceProviderConfiguration()
            {
                Name        = ConfigurationManager.AppSettings[ServiceProviderName],
                Description = ConfigurationManager.AppSettings[ServiceProviderDescription],
                AssertionConsumerServiceUrl = ConfigurationManager.AppSettings[ServiceProviderAssertionConsumerServiceUrl],
                LocalCertificateFile        = ConfigurationManager.AppSettings[ServiceProviderLocalCertificateFile],
                LocalCertificatePassword    = ConfigurationManager.AppSettings[ServiceProviderLocalCertificatePassword]
            };

            var spConfig = Utils.SerializeToJson(samlConfiguration.LocalServiceProviderConfiguration);

            SamlPocTraceListener.Log("SAML", $"SamlConfigurationManager.ConfigureServiceProvider: Service Provider configuration:\r\n{spConfig}");
        }