c22b4a2613
NUOVE FUNZIONALITÀ: - Aggiunto modulo CredentialManager per gestione centralizzata credenziali - Implementata UI Blazor per gestione credenziali (CredentialManagement.razor) - Supporto completo per credenziali database (SQL Server, MySQL, PostgreSQL, Oracle, SQLite, DB2, SAP HANA) - Gestione unificata REST API con supporto specifico per SAP B1 Service Layer e Salesforce - Test reali di connessione per database, SAP B1 e Salesforce OAuth2 - Selezione dinamica tipo servizio REST (Generico, SAP B1, Salesforce) con campi specifici - Persistenza sicura di credenziali con crittografia password e campi sensibili COMPONENTI AGGIUNTI: - CredentialManager/Models/: CredentialEntity, CredentialModels (DatabaseCredential, RestApiCredential, SapB1ServiceLayerCredential, SalesforceCredential) - CredentialManager/Services/: CredentialService, EncryptionService, DatabaseInitializer - CredentialManager/Data/: CredentialDbContext con Entity Framework - DataConnection/CredentialManagement/: Interfacce e servizi di integrazione - Data_Coupler/Pages/CredentialManagement.razor: UI completa per gestione credenziali MIGLIORAMENTI UI: - Form dinamica per REST API con campi specifici per tipo servizio - Validazione campi obbligatori per Salesforce (ClientId, ClientSecret, SecurityToken) - Test connessione in tempo reale dalla modale di inserimento/modifica - Rimozione sezioni separate per SAP B1 e Salesforce (ora unificate in REST API) - Gestione stato loading durante operazioni async PERSISTENZA AVANZATA: - Campo RestServiceType aggiunto a CredentialEntity con migrazione automatica - Serializzazione campi specifici Salesforce/SAP B1 in AdditionalParameters JSON - Mapping bidirezionale tra entità database e modelli business - Gestione nullability e conversioni tipo sicure SICUREZZA: - Crittografia AES-256 per password e token sensibili - Gestione sicura ConnectionString database - Validazione input e sanitizzazione dati TESTING E CONNETTIVITÀ: - Test autenticazione reale SAP B1 Service Layer - Test OAuth2 Salesforce con supporto Connected App - Test connettività database multi-provider - Logging dettagliato per debugging e monitoraggio CONFIGURAZIONE: - Dependency injection per tutti i servizi - Configurazione Entity Framework con SQLite - Tasks VS Code per build e run - Gestione connection string centralizzata CORREZIONI: - Risolti errori nullability in CredentialService - Aggiunto using Microsoft.JSInterop per IJSRuntime - Fix compilazione e warning Files modificati: 35+ file tra nuovi e aggiornati
89 lines
2.6 KiB
C#
89 lines
2.6 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using CredentialManager.Models;
|
|
|
|
namespace CredentialManager.Data;
|
|
|
|
/// <summary>
|
|
/// DbContext per la gestione delle credenziali
|
|
/// </summary>
|
|
public class CredentialDbContext : DbContext
|
|
{
|
|
public DbSet<CredentialEntity> Credentials { get; set; }
|
|
|
|
public CredentialDbContext(DbContextOptions<CredentialDbContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder); // Configurazione della tabella Credentials
|
|
modelBuilder.Entity<CredentialEntity>(entity =>
|
|
{
|
|
entity.ToTable("Credentials");
|
|
|
|
entity.HasKey(e => e.Id);
|
|
|
|
entity.Property(e => e.Name)
|
|
.IsRequired()
|
|
.HasMaxLength(100);
|
|
|
|
entity.Property(e => e.Type)
|
|
.IsRequired()
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.DatabaseType)
|
|
.HasMaxLength(50);
|
|
|
|
entity.Property(e => e.ConnectionString)
|
|
.HasMaxLength(500);
|
|
|
|
entity.Property(e => e.Host)
|
|
.HasMaxLength(200);
|
|
|
|
entity.Property(e => e.DatabaseName)
|
|
.HasMaxLength(100);
|
|
|
|
entity.Property(e => e.Username)
|
|
.HasMaxLength(100);
|
|
|
|
entity.Property(e => e.EncryptedApiKey)
|
|
.HasMaxLength(500);
|
|
|
|
entity.Property(e => e.EncryptedAuthToken)
|
|
.HasMaxLength(500);
|
|
|
|
entity.Property(e => e.Headers)
|
|
.HasMaxLength(2000);
|
|
|
|
entity.Property(e => e.AdditionalParameters)
|
|
.HasMaxLength(2000);
|
|
|
|
entity.Property(e => e.CreatedBy)
|
|
.HasMaxLength(100);
|
|
|
|
// Valori di default
|
|
entity.Property(e => e.CommandTimeout)
|
|
.HasDefaultValue(30);
|
|
|
|
entity.Property(e => e.TimeoutSeconds)
|
|
.HasDefaultValue(100);
|
|
|
|
entity.Property(e => e.IgnoreSslErrors)
|
|
.HasDefaultValue(false);
|
|
|
|
entity.Property(e => e.IsActive)
|
|
.HasDefaultValue(true);
|
|
|
|
// Indici
|
|
entity.HasIndex(e => e.Name)
|
|
.IsUnique();
|
|
|
|
entity.HasIndex(e => e.Type);
|
|
|
|
entity.HasIndex(e => e.DatabaseType);
|
|
|
|
entity.HasIndex(e => e.IsActive);
|
|
});
|
|
}
|
|
}
|