diff --git a/backend/RESTful API/Program.cs b/backend/RESTful API/Program.cs index 7edbabe..f54369c 100644 --- a/backend/RESTful API/Program.cs +++ b/backend/RESTful API/Program.cs @@ -16,8 +16,12 @@ var builder = WebApplication.CreateBuilder(args); // Configurar JWT -var key = Encoding.ASCII.GetBytes( - builder.Configuration["JwtSettings:Secret"] ?? "chave-super-secreta"); +var jwtSecret = builder.Configuration["JwtSettings:Secret"]; +if (string.IsNullOrEmpty(jwtSecret) || jwtSecret == "YOUR_JWT_SECRET_KEY_HERE_MIN_32_CHARS" || jwtSecret.Length < 32) +{ + throw new InvalidOperationException("A valid JWT Secret must be configured in JwtSettings:Secret. The secret must be at least 32 characters long and not the default placeholder."); +} +var key = Encoding.ASCII.GetBytes(jwtSecret); // Connection string var connectionString = builder.Configuration.GetConnectionString("DefaultConnection"); diff --git a/backend/RESTful API/appsettings.json b/backend/RESTful API/appsettings.json index 9f59bc9..bc6a6ed 100644 --- a/backend/RESTful API/appsettings.json +++ b/backend/RESTful API/appsettings.json @@ -8,7 +8,7 @@ "AllowedHosts": "*", "JwtSettings": { - "Secret": "S3gr3d0SuperSeguroComMaisDe32Caracteres" + "Secret": "YOUR_JWT_SECRET_KEY_HERE_MIN_32_CHARS" }, "ConnectionStrings": {