refactor: address code review findings across all projects
Apply comprehensive fixes from code reviews including: - Extract shared utilities (SqlFormatHelper, CellValueConverter, DbDestinationBase) - Add interface abstractions (IAuthenticationService, IDatabaseMigrator, IMisQueryBuilder) - Implement SecureStore for encrypted secrets storage - Fix error handling with proper HTTP status codes and logging - Optimize double enumeration in DevEtlRegistry - Add DataSync.Dev README for developer onboarding - Extract filter panel base classes to reduce duplication - Update code review docs to mark all issues as fixed
This commit is contained in:
@@ -33,26 +33,27 @@ public static class InfrastructureDependencyInjection
|
||||
|
||||
if (ldapOptions?.UseFakeAuth == true)
|
||||
{
|
||||
services.AddScoped<IAuthService, FakeAuthService>();
|
||||
services.AddScoped<IAuthenticationService, FakeAuthService>();
|
||||
}
|
||||
else
|
||||
{
|
||||
services.AddScoped<IAuthService, LdapAuthService>();
|
||||
services.AddScoped<IAuthenticationService, LdapAuthService>();
|
||||
}
|
||||
|
||||
// Register RSA key service for login encryption
|
||||
// Register SecureStore for encrypted secrets storage
|
||||
services.Configure<SecureStoreOptions>(
|
||||
configuration.GetSection(SecureStoreOptions.SectionName));
|
||||
|
||||
services.AddSingleton<ISecureStoreService, SecureStoreService>();
|
||||
|
||||
// Register RSA key service backed by SecureStore
|
||||
services.Configure<RsaKeyOptions>(
|
||||
configuration.GetSection(RsaKeyOptions.SectionName));
|
||||
|
||||
var rsaKeyOptions = configuration
|
||||
.GetSection(RsaKeyOptions.SectionName)
|
||||
.Get<RsaKeyOptions>() ?? new RsaKeyOptions();
|
||||
services.AddSingleton<IRsaKeyService, SecureStoreRsaKeyService>();
|
||||
|
||||
var keyPath = Path.IsPathRooted(rsaKeyOptions.KeyFilePath)
|
||||
? rsaKeyOptions.KeyFilePath
|
||||
: Path.Combine(AppContext.BaseDirectory, rsaKeyOptions.KeyFilePath);
|
||||
|
||||
services.AddSingleton<IRsaKeyService>(new RsaKeyService(keyPath));
|
||||
// Register secrets migrator for one-time migration of existing secrets
|
||||
services.AddSingleton<SecretsMigrator>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user