/// <summary> /// /Método para adicionar servicios al contenedor. /// </summary> /// <param name="services"></param> public void ConfigureServices(IServiceCollection services) { services.AddConfigureService(this.Configuration); services.AddMemoryCache(); services.AddOptions(); services.AddCorsService(); services.AddSingletonService(); services.AddRouting(options => options.LowercaseUrls = true); services.AddSwaggerGenService(); services.AddApiVersioningService(); services.AddMvcService(); services.AddDistributedSqlServerCache(options => { options.ConnectionString = DecryptFunction.Decrypt(Configuration.GetSection("DistributedSqlServerCache").GetSection("ConnectionString").Value, "PFA"); options.SchemaName = Configuration.GetSection("DistributedSqlServerCache").GetSection("SchemaName").Value; options.TableName = Configuration.GetSection("DistributedSqlServerCache").GetSection("TableName").Value; }); }
public LoginModel GetUserDetails(string id) { DecryptFunction de = new DecryptFunction(); //string uid = de.Decrypt(id); string uid = ""; //var con = ConfigurationManager.ConnectionStrings["LFGEntities"].ToString(); var AllowEncryption = System.Configuration.ConfigurationSettings.AppSettings["AllowEncryption"]; if (AllowEncryption.Equals("true")) { // uid = DECRYPTPP.Decryptmy(id); uid = de.Decrypt(id); //enable for live } else { uid = id; } return(UserDAL.GetEmployeeDetails(uid, "")); // return UserDAL.GetEmployeeDetails(uid, con); }
public void DecryptSinClaveTest() { string resultado = DecryptFunction.Decrypt("b+K8cNo20csEyWOFwTxPbw==", null); Assert.Contains("1234", resultado); }
public void DecryptSinTextoTest() { string resultado = DecryptFunction.Decrypt(null, "A"); Assert.Null(resultado); }
/// <summary> /// Método para iniciar el host de la aplicación. /// </summary> /// <param name="args"></param> /// <returns></returns> public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup <Startup>() .UseSerilog((context, config) => { context.Configuration.GetSection("Serilog:WriteTo:0:Args:connectionString").Value = DecryptFunction.Decrypt(context.Configuration.GetSection("Serilog:WriteTo:0:Args:connectionString").Value, "PFA"); config.ReadFrom.Configuration(context.Configuration); }) .Build();