Support encrypted cache conn strings & update dependencies
Moved DecryptConnectionString to KBR.Shared.Extensions for reuse and improved configuration access. Added Encryption property to CacheOptions and appsettings for conditional decryption of cache connection strings. Updated ServiceCollectionExtensions to decrypt SQL Server cache connection strings when needed. Upgraded NuGet packages across projects to latest .NET 8/10.0.x versions. Included minor code cleanups and OpenApiSecurityScheme improvements.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using KBR.Cache.Constants;
|
||||
using KBR.Cache.Options;
|
||||
using KBR.Shared.Extensions;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
@@ -20,9 +21,14 @@ namespace KBR.Cache.Extensions
|
||||
}
|
||||
else if (cacheOptions.Provider == CacheProviders.SqlServer)
|
||||
{
|
||||
var connectionString = cacheOptions.ConnectionString;
|
||||
if ((bool)cacheOptions.Encryption)
|
||||
{
|
||||
connectionString = configuration.DecryptConnectionString(connectionString);
|
||||
}
|
||||
services.AddDistributedMySqlCache(options =>
|
||||
{
|
||||
options.ConnectionString = cacheOptions.ConnectionString;
|
||||
options.ConnectionString = connectionString;
|
||||
options.TableName = "Cache";
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user