/// <summary> /// Returns a selected certificate based on configuration. /// </summary> /// <param name="certificateSubject">The subject serial number of the certificate</param> /// <returns>Returns a selected certificate based on configuration.</returns> public X509Certificate2 GetCertificate(CertificateSubject certificateSubject) { CertificateLoader certificateLoader = new CertificateLoader(); switch (_config.Action) { case LdapCertificateLookupTestConfig.LookupAction.FindCertificate: // 1. Attempt to load the certificate from store: return(certificateLoader.GetCertificateFromStoreWithSSN( certificateSubject.SerialNumberValue, _config.StoreLocation, _config.StoreName )); case LdapCertificateLookupTestConfig.LookupAction.ConnectionFailed: LdapSettings settings = ConfigurationHandler.GetConfigurationSection <LdapSettings>(); throw new ConnectingToLdapServerFailedException(settings, new Exception(this.ToString())); case LdapCertificateLookupTestConfig.LookupAction.SearchFailed: throw new SearchFailedException(new Exception(this.ToString())); default: throw new NotImplementedException(); } }
void App_Startup(object sender, StartupEventArgs e) { LoggingHandler.Log("Handling configuration..."); Config = ConfigurationHandler.Read(); player = new Player { Volume = Config.Volume }; if (Config.Language != "automatic") { System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Config.Language); } ChangeSkin(Config.Theme); LoggingHandler.Log("Handling command line args..."); if (e.Args.Length > 0) { var args = e.Args.Where(x => x.Contains('.')); if (e.Args.Contains("--tageditor")) { currentWindow = new TagEditor(args.ToList(), player); } else { currentWindow = new MainWindow(player, args.ToArray()); } } else { currentWindow = new MainWindow(player); } currentWindow.Show(); }
/// <summary> /// Creates an IUddiLookup implementation, as set in config. /// </summary> /// <returns>The IUddiLookup implementation</returns> public IUddiLookupClient CreateUddiLookupClient(Uri address) { // 1. Get factory config: _config = ConfigurationHandler.GetConfigurationSection <UddiLookupClientFactoryConfig>(); // 2. Get the type to load: if (string.IsNullOrEmpty(_config.ImplementationNamespaceClass)) { throw new UddiNoImplementingClassException(); } if (string.IsNullOrEmpty(_config.ImplementationAssembly)) { throw new UddiNoImplementingAssemblyException(); } string qualifiedTypename = _config.ImplementationNamespaceClass + ", " + _config.ImplementationAssembly; Type lookupClientType = Type.GetType(qualifiedTypename); if (lookupClientType == null) { throw new CouldNotLoadTypeException(qualifiedTypename); } // 3. Instantiate the type: object[] parameters = new object[] { address }; Type[] typeArray = new Type[] { typeof(Uri) }; ConstructorInfo constructorInfo = lookupClientType.GetConstructor(typeArray); IUddiLookupClient lookupClient = (IUddiLookupClient)constructorInfo.Invoke(parameters); return(lookupClient); }
/// <summary> /// Default constructor. Attempts to load configuration from configuration file. /// </summary> public OcspLookup() { this.logger = LoggerFactory.Create(this); OcspConfig configuration = ConfigurationHandler.GetConfigurationSection <OcspConfig>(); this.Init(configuration, null); }
public bool Validate(OiosiMessage oiosiMessage) { bool result = true; SendingOptionConfig sendingOptionConfig = ConfigurationHandler.GetConfigurationSection <SendingOptionConfig>(); this.logger.Trace("Start SendingValidation"); if (sendingOptionConfig.SchemaValidationBool) { this.logger.Trace("Start schema"); SchemaValidatorWithLookup schemaValidatorWithLookup = new SchemaValidatorWithLookup(); //string document = oiosiMessage.MessageXml XmlDocument document = oiosiMessage.MessageXml; schemaValidatorWithLookup.Validate(document.OuterXml); result = true; } if (result && sendingOptionConfig.SchematronValidationBool) { this.logger.Trace("Start schematron"); SchematronValidatorWithLookup schematronValidatorWithLookup = new SchematronValidatorWithLookup(); //string document = oiosiMessage.MessageString; XmlDocument document = oiosiMessage.MessageXml; schematronValidatorWithLookup.Validate(document.OuterXml); result = true; } this.logger.Trace("Finish SendingValidation"); return(result); }
public ActionResult RicercaElementi(string descrizione, string ragione) { logger.Info("begin"); try { //NavigationHandler.CurrentUser.Ruoli logger.Debug("descrizione: " + descrizione); logger.Debug("ragione:" + ragione); RicercaSmistamentoRequest request = new RicercaSmistamentoRequest(); ConfigurationHandler confHandler = new ConfigurationHandler(); request.Descrizione = descrizione; request.UserInfo = NavigationHandler.CurrentUser; request.Ruolo = NavigationHandler.RuoloInfo; logger.Debug("idAmministrazione: " + request.UserInfo.IdAmministrazione); request.NumMaxResults = confHandler.MaxNumRisultatiAutocomplete; request.numMaxResultsForCategory = confHandler.MaxNumRisultatiAutocompleteURP; // MEV SMISTAMENTO // metto nella request il tipo di ragione (competenza/conoscenza) request.Ragione = ragione; logger.Debug("Chiamata ws..."); RicercaSmistamentoResponse response = WSStub.ricercaSmistamento(request); logger.Info("end"); return(JsonWithConverters(response.Elements)); } catch (Exception e) { logger.Error("Exception: " + e); return(null); } }
/// <summary> /// Set default, test Ocsp factory /// </summary> public override void SetTestRevocationLookupFactoryConfig() { RevocationLookupFactoryConfig revoFactoryConfig = ConfigurationHandler.GetConfigurationSection <RevocationLookupFactoryConfig>(); revoFactoryConfig.ImplementationAssembly = "dk.gov.oiosi.library"; revoFactoryConfig.ImplementationNamespaceClass = "dk.gov.oiosi.security.revocation.ocsp.OcspLookupTest"; }
static X509Certificate2 Ldap(CertificateSubject certSubject) { LdapSettings settings = ConfigurationHandler.GetConfigurationSection <LdapSettings>(); // Print out info Console.WriteLine(); Console.WriteLine("2. Certificate download"); Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine(" Using host"); Console.WriteLine(" " + settings.Host); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(); // Create the LDAP client LdapLookupFactory ldapClientFactory = new LdapLookupFactory(); ICertificateLookup ldapClient = ldapClientFactory.CreateLdapLookupClient(); // Lookup the certificate using LDAP X509Certificate2 certificate = ldapClient.GetCertificate(certSubject); Console.WriteLine(" Downloaded certificate with LDAP:"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(" " + certificate.Subject); Console.ForegroundColor = ConsoleColor.White; return(certificate); }
public ActionResult RicercaUtentiInRuolo(string descrizione) { logger.Debug("RicercaUtentiInRuolo"); logger.Info("begin"); try { //NavigationHandler.CurrentUser.Ruoli logger.Debug("descrizione: " + descrizione); RicercaSmistamentoRequest request = new RicercaSmistamentoRequest(); ConfigurationHandler confHandler = new ConfigurationHandler(); request.Descrizione = descrizione; request.UserInfo = NavigationHandler.CurrentUser; request.Ruolo = NavigationHandler.RuoloInfo; logger.Debug("idAmministrazione: " + request.UserInfo.IdAmministrazione); request.NumMaxResults = -99; request.numMaxResultsForCategory = confHandler.MaxNumRisultatiAutocompleteURP; logger.Debug("Chiamata ws..."); //RicercaSmistamentoResponse response = WSStub.ricercaSmistamento(request); RicercaSmistamentoResponse response = WSStub.aggiungiSmistamentoElement(request); logger.Info("end"); return(JsonWithConverters(response.Elements)); } catch (Exception e) { logger.Error("Exception: " + e); return(null); } }
private void updateProductsList() { if (SelectedTable != null) { MySqlConnection con = null; try { String query = "SELECT products.name, products.description, products.image, COUNT(products.id) as quantity, sum(products.price) as price from consumitions inner join products on consumitions.productID = products.id where consumitions.serviceID = (SELECT actualServiceID FROM tables WHERE id = " + SelectedTable + ") GROUP BY products.id"; ConfigurationHandler Config = new ConfigurationHandler(); String host = Config.getSetting("host", "Connection"); String port = Config.getSetting("port", "Connection"); String database = Config.getSetting("database", "Connection"); String user = Config.getSetting("username", "Connection"); String pass = Config.getSetting("password", "Connection"); String ruta = "Data Source=" + host + ";port=" + port + ";Database=" + database + ";Uid=" + user + ";Password="******"productsDataBinding"); productsList.DataContext = ds; SelectedServiceTotal = ds.Tables[0].Compute("SUM(price)", String.Empty).ToString(); } catch (Exception exc) { Console.WriteLine(exc.Message.ToString()); } finally { if (con != null) { con.Close(); } } } }
private void updateTables() { MySqlConnection con = null; //Update Tables try { String query = "SELECT * FROM `tables`"; ConfigurationHandler Config = new ConfigurationHandler(); String host = Config.getSetting("host", "Connection"); String port = Config.getSetting("port", "Connection"); String database = Config.getSetting("database", "Connection"); String user = Config.getSetting("username", "Connection"); String pass = Config.getSetting("password", "Connection"); String ruta = "Data Source=" + host + ";port=" + port + ";Database=" + database + ";Uid=" + user + ";Password="******"LoadDataBinding"); TablesList.DataContext = ds; } catch (Exception exc) { Console.WriteLine(exc.Message.ToString()); } finally { if (con != null) { con.Close(); } } }
static void Main(string[] args) { Console.WriteLine("Transportation Demo- Simulated Gate/Reader. Ctrl-C to exit.\n"); // setup the items used by the simulated device TransportationDeviceClient myClient = new TransportationDeviceClient(ConfigurationHandler.getConfig("AppSettings", "IoTConnectionString")); EventScheduler myScheduler = new EventScheduler(); // get device configuration details from JSON file GateReaderDeviceConfig deviceConfig = JsonConvert.DeserializeObject <GateReaderDeviceConfig>(ConfigurationHandler.GetDeviceRuntimeSettings("deviceConfig")); // create our simulated device myGateReader = new GateReaderDevice(deviceConfig, myClient, myScheduler); // initialize the device, setting up initial connections myGateReader.InitializeAsync().Wait(); // start the device running myGateReader.StartAllEvents(); // put the host into a loop while (true) { //do stuff Thread.Sleep(30000); } myGateReader.StopAllEvents(); Console.ReadLine(); }
public void MyTest() { string fileName = "RaspConfiguration.UnitTest.SetupAllSections.xml"; ConfigurationHandler.ConfigFilePath = fileName; DocumentTypeCollectionConfig configuration = ConfigurationHandler.GetConfigurationSection <DocumentTypeCollectionConfig>(); }
/// <summary> /// Builds an instance of an IRevocationLookup client based on configuration. /// </summary> /// <returns>ocsp lookup</returns> private IRevocationLookup CreateInstance() { // 1. Get factory config: RevocationLookupFactoryConfig config = ConfigurationHandler.GetConfigurationSection <RevocationLookupFactoryConfig>(); return(this.CreateInstance(config)); }
public EntityConnectionStringBuilder ConnectionString() { var entityConf = new ConfigurationHandler().Read().Sql.ServerInformation; const string providerName = "System.Data.SqlClient"; var serverName = entityConf.Server; var databaseName = entityConf.Database; var userName = entityConf.Username; var password = entityConf.Password; // Initialize the connection string builder for the // underlying provider. var sqlBuilder = new SqlConnectionStringBuilder { DataSource = serverName, InitialCatalog = databaseName, IntegratedSecurity = true, UserID = userName, Password = password }; // Build the SqlConnection connection string. var providerString = sqlBuilder.ToString(); // Initialize the EntityConnectionStringBuilder. var entityBuilder = new EntityConnectionStringBuilder { Provider = providerName, ProviderConnectionString = providerString, Metadata = @"res://*/Entities.ErrorDb.csdl|res://*/Entities.ErrorDb.ssdl|res://*/Entities.ErrorDb.msl" }; return(entityBuilder); }
/// <summary> /// Set default live config values /// </summary> public virtual void SetOscpConfig() { // Live certificates here OcspConfig ocspConfig = ConfigurationHandler.GetConfigurationSection <OcspConfig>(); ocspConfig.DefaultTimeoutMsec = 20000; }
/// <summary> /// Gets the single instance of the schematron store /// </summary> /// <returns></returns> public static SchematronStore GetSchematronStore() { lock (_lockObject) { if (_instance == null) { ISchematronStoreConfig config; if (ConfigurationHandler.HasConfigurationSection <SchematronStoreConfig>()) { config = ConfigurationHandler.GetConfigurationSection <SchematronStoreConfig>(); } else { config = (SchematronStoreConfig)ConfigurationManager.GetSection(SchematronStoreAppConfig.SCHEMATRONSTOREAPPCONFIGNAME); } if (config == null) { _instance = new SchematronStore(); } else { _instance = new SchematronStore(config); } } return(_instance); } }
public void ReadConfiguration() { var config = new ConfigurationHandler().Read(); Assert.IsNotNull(config); Assert.IsNotNull(config.LoggingLevel); }
/// <summary> /// Use the default values /// </summary> public void SetIfNotExistsOcesCertificateConfig() { if (ConfigurationHandler.HasConfigurationSection <SchematronStoreConfig>()) { return; } SetSchematronStoreConfig(); }
protected override async Task OnInitializedAsync() { var configuration = await Http.GetJsonAsync <ConfigurationData>("/configuration.json"); var configurationHandler = new ConfigurationHandler(); configurationHandler.Set(configuration); }
public SqlReader() { var configHandler = new ConfigurationHandler(); _config = configHandler.Read(); BuildSqlConnection(); }
/// <summary> /// Sets the test uddi lookup factory configuration if it does not exist /// </summary> public virtual void SetIfNotExistsTestUddiLookupFactoryConfig() { if (ConfigurationHandler.HasConfigurationSection <UddiLookupClientFactoryConfig>()) { return; } SetTestUddiLookupFactoryConfig(); }
/// <summary> /// Sets the default test uddi configuration if it does not exist /// </summary> public virtual void SetIfNotExistsDefaultUddiConfigTest() { if (ConfigurationHandler.HasConfigurationSection <UddiLookupClientTestConfig>()) { return; } SetDefaultUddiConfigTest(); }
private AdvancedUddiDummyClient.AdvancedUddiDummyClientConfig GetClearDummyConfig() { // Clears the dummy so that all calls return a result AdvancedUddiDummyClient.AdvancedUddiDummyClientConfig dummyConfig = ConfigurationHandler.GetConfigurationSection <AdvancedUddiDummyClient.AdvancedUddiDummyClientConfig>(); dummyConfig.NonExistingRegistrations.Clear(); dummyConfig.ErroneousEndpoints.Clear(); return(dummyConfig); }
private IMCollection <ITestSuite> GetTestSuites() { IConfigurationHandler configurationHandler = new ConfigurationHandler(); IConfiguration configuration = configurationHandler.ToHandleTestConfiguration(_configuration); return(configuration.GetTestsSuites(this)); }
/// <summary> /// Use the dafult, live factory /// </summary> public virtual void SetIfNotExistsLdapLookupFactoryConfig() { if (ConfigurationHandler.HasConfigurationSection <LdapLookupFactoryConfig>()) { return; } SetLdapLookupFactoryConfig(); }
/// <summary> /// Use default, live values /// </summary> public virtual void SetIfNotExistsDefaultLdapConfig() { if (ConfigurationHandler.HasConfigurationSection <LdapSettings>()) { return; } SetDefaultLdapConfig(); }
/// <summary> /// Sets the default live root certificate configuration if it does not exist in configuration /// </summary> public virtual void SetIfNotExistsProductionDefaultRootCertificateCollectionConfig() { if (ConfigurationHandler.HasConfigurationSection <RootCertificateCollectionConfig>()) { return; } SetProductionDefaultRootCertificateCollectionConfig(); }
public void WriteConfiguration() { var config = new ConfigurationHandler().Read(); var writer = new ConfigurationHandler().Write(config); Assert.IsTrue(writer); }
/// <summary> /// Use the test values /// </summary> public virtual void SetIfNotExistsTestOcesCertificateConfig() { if (ConfigurationHandler.HasConfigurationSection <OcesX509CertificateConfig>()) { return; } SetTestOcesCertificateConfig(); }
public ConfigurationNode(bool __enable, ConfigurationHandler __configure) { enable = __enable; configure = __configure; }