private string ConvertPropertiesToArasUpdateCmdArguments(Component component, Dictionary <string, string> propertyNameMapper) { List <string> componentProperties = new List <string>(); foreach (PropertyInfo property in component.GetType().GetProperties()) { string propertyValueString = null; if (property.PropertyType == typeof(string)) { object propertyValue = property.GetValue(component); propertyValueString = propertyValue == null ? string.Empty : propertyValue.ToString(); } else if (property.PropertyType == typeof(SecretString)) { SecretString secretProperty = property.GetValue(component) as SecretString; propertyValueString = secretProperty?.Value; } if (propertyValueString != null) { componentProperties.Add(string.Format("-D:{0}=\"{1}\"", propertyNameMapper != null && propertyNameMapper.ContainsKey(property.Name) ? propertyNameMapper[property.Name] : property.Name, propertyValueString)); } } return(string.Join(" ", componentProperties)); }
public void SendSecretCodeToUser([FromBody, SwaggerRequestBody("Email to send code", Required = true)] string email) { log.Info(nameof(SendSecretCodeToUser)); try { if (codeService.Count(email) < 3) { var secretString = SecretString.GetSecretString(); mailService.SendEmail(email, secretString, "Your personal code"); var code = new SecretCode() { Code = secretString, Email = email }; codeService.Add(code); } } catch (Exception e) { log.Error(e); } }
public void Save(string stringToSave, string identifier) { var alias = MakeAlias(identifier); var secretKey = new SecretString(stringToSave); var entry = new KeyStore.SecretKeyEntry(secretKey); _keyStore.SetEntry(alias, entry, _passwordProtection); Save(); }
/// <inheritdoc /> public Task Save(string identifier, string stringToSave) { var alias = MakeAlias(identifier); var secretKey = new SecretString(stringToSave); var entry = new KeyStore.SecretKeyEntry(secretKey); _keyStore.SetEntry(alias, entry, _passwordProtection); Save(); return(Task.CompletedTask); }
public void SetupApplicationPool(string serverName, string apppoolName, string managedRuntimeVersion, string managedPipelineMode, string appPoolUser, SecretString appPoolUserPassword) { using (ServerManager serverManager = ServerManager.OpenRemote(serverName)) { ApplicationPool appPool = serverManager.ApplicationPools[apppoolName]; if (appPool == null) { Logger.Instance.Log(LogLevel.Info, "\tCreating new '{0}' application pool on '{1}'...", apppoolName, serverName); appPool = serverManager.ApplicationPools.Add(apppoolName); } else { Logger.Instance.Log(LogLevel.Info, "\tRecycling '{0}' application pool on '{1}'...", apppoolName, serverName); appPool.Recycle(); } Logger.Instance.Log(LogLevel.Info, "\tSetting up '{0}' managed runtime version and '{1}' managed pipeline mode '{2}' application pool.", managedRuntimeVersion, managedPipelineMode, apppoolName); appPool.ManagedRuntimeVersion = managedRuntimeVersion; appPool.ManagedPipelineMode = ParseManagedPipelineMode(managedPipelineMode); if (!string.IsNullOrEmpty(appPoolUser) && appPoolUserPassword != null) { Logger.Instance.Log(LogLevel.Info, "\tSetting up '{0}' user for '{1}' application pool.", appPoolUser, apppoolName); appPool.ProcessModel.IdentityType = ProcessModelIdentityType.SpecificUser; appPool.ProcessModel.UserName = appPoolUser; appPool.ProcessModel.Password = appPoolUserPassword.Value; } serverManager.CommitChanges(); Logger.Instance.Log(LogLevel.Info, "\tChanges were commited."); } }