From 6f25b2ef95661ce4de05a4c34d916fd4c4653342 Mon Sep 17 00:00:00 2001 From: Angelo Pirola Date: Sat, 21 Dec 2024 09:41:58 +0100 Subject: [PATCH 1/5] Aggiornati pacchetti Nuget --- .../AutenticazioneSvc.Shared/AutenticazioneSvc.Shared.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AutenticazioneSvc/AutenticazioneSvc.Shared/AutenticazioneSvc.Shared.csproj b/src/AutenticazioneSvc/AutenticazioneSvc.Shared/AutenticazioneSvc.Shared.csproj index 05af574..0384549 100644 --- a/src/AutenticazioneSvc/AutenticazioneSvc.Shared/AutenticazioneSvc.Shared.csproj +++ b/src/AutenticazioneSvc/AutenticazioneSvc.Shared/AutenticazioneSvc.Shared.csproj @@ -7,7 +7,7 @@ - + From 6996fb6c78d9b4ef3a416f56aa07e28e6cc2e7e8 Mon Sep 17 00:00:00 2001 From: Angelo Pirola Date: Sat, 21 Dec 2024 09:42:21 +0100 Subject: [PATCH 2/5] Aggiunto Logger + Refactoring --- .../HostedService/AuthStartupTask.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/AutenticazioneSvc/AutenticazioneSvc.BusinessLayer/HostedService/AuthStartupTask.cs b/src/AutenticazioneSvc/AutenticazioneSvc.BusinessLayer/HostedService/AuthStartupTask.cs index b99aef2..20ebbea 100644 --- a/src/AutenticazioneSvc/AutenticazioneSvc.BusinessLayer/HostedService/AuthStartupTask.cs +++ b/src/AutenticazioneSvc/AutenticazioneSvc.BusinessLayer/HostedService/AuthStartupTask.cs @@ -4,11 +4,14 @@ using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; namespace AutenticazioneSvc.BusinessLayer.HostedService; -public class AuthStartupTask(IServiceProvider serviceProvider) : IHostedService +public class AuthStartupTask(IServiceProvider serviceProvider, ILogger logger) : IHostedService { + private readonly ILogger _logger = logger; + public async Task StartAsync(CancellationToken cancellationToken) { using var scope = serviceProvider.CreateScope(); @@ -20,7 +23,7 @@ public async Task StartAsync(CancellationToken cancellationToken) await GenerateAdminUserProfileAsync(userManager); } - private static async Task GenerateAdminUserProfileAsync(UserManager userManager) + private async Task GenerateAdminUserProfileAsync(UserManager userManager) { var administratorUser = new ApplicationUser { @@ -33,8 +36,10 @@ private static async Task GenerateAdminUserProfileAsync(UserManager roleMa } public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; -} \ No newline at end of file +} From 4d2f62be693e1521ab0d1a634350ef32d64137d0 Mon Sep 17 00:00:00 2001 From: Angelo Pirola Date: Sat, 21 Dec 2024 09:42:31 +0100 Subject: [PATCH 3/5] Aggiornati pacchetti Nuget --- src/GatewaySvc/GatewaySvc/GatewaySvc.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GatewaySvc/GatewaySvc/GatewaySvc.csproj b/src/GatewaySvc/GatewaySvc/GatewaySvc.csproj index 7a5a5d3..9ad0ec4 100644 --- a/src/GatewaySvc/GatewaySvc/GatewaySvc.csproj +++ b/src/GatewaySvc/GatewaySvc/GatewaySvc.csproj @@ -8,7 +8,7 @@ - + From df71aea9a0962455b38600cc44e46e0dc7d9d607 Mon Sep 17 00:00:00 2001 From: Angelo Pirola Date: Sat, 21 Dec 2024 09:42:43 +0100 Subject: [PATCH 4/5] Refactoring Dockerfile --- .../ocelot.gestionedocumenti.json | 37 +++++++++++++++++++ src/GatewaySvc/GatewaySvc/Dockerfile | 1 + 2 files changed, 38 insertions(+) create mode 100644 src/GatewaySvc/GatewaySvc/ConfigOcelot/ocelot.gestionedocumenti.json diff --git a/src/GatewaySvc/GatewaySvc/ConfigOcelot/ocelot.gestionedocumenti.json b/src/GatewaySvc/GatewaySvc/ConfigOcelot/ocelot.gestionedocumenti.json new file mode 100644 index 0000000..e9a68d2 --- /dev/null +++ b/src/GatewaySvc/GatewaySvc/ConfigOcelot/ocelot.gestionedocumenti.json @@ -0,0 +1,37 @@ +{ + "Routes": [ + { + "DownstreamPathTemplate": "/api/v1/documenti/download/{fileName}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "alb-gestionedocumenti", + "Port": 5001 + } + ], + "UpstreamPathTemplate": "/documento/{fileName}", + "UpstreamHttpMethod": [ "Get" ], + "AuthenticationOptions": { + "AuthenticationProviderKey": "Bearer", + "AllowedScopes": [] + } + }, + { + "DownstreamPathTemplate": "/api/v1/documenti/upload", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "alb-gestionedocumenti", + "Port": 5001 + } + ], + "UpstreamPathTemplate": "/documento", + "UpstreamHttpMethod": [ "Post" ], + "AuthenticationOptions": { + "AuthenticationProviderKey": "Bearer", + "AllowedScopes": [] + } + } + ], + "GlobalConfiguration": {} +} \ No newline at end of file diff --git a/src/GatewaySvc/GatewaySvc/Dockerfile b/src/GatewaySvc/GatewaySvc/Dockerfile index a6c53b8..18ff0b7 100644 --- a/src/GatewaySvc/GatewaySvc/Dockerfile +++ b/src/GatewaySvc/GatewaySvc/Dockerfile @@ -8,6 +8,7 @@ COPY ["src/GatewaySvc/GatewaySvc/GatewaySvc.csproj", "src/GatewaySvc/GatewaySvc/ # Copy the Ocelot configuration files COPY ["src/GatewaySvc/GatewaySvc/ConfigOcelot/ocelot.configurazioni.json", "src/GatewaySvc/GatewaySvc/ConfigOcelot/"] +COPY ["src/GatewaySvc/GatewaySvc/ConfigOcelot/ocelot.gestionedocumenti.json", "src/GatewaySvc/GatewaySvc/ConfigOcelot/"] RUN dotnet restore "src/GatewaySvc/GatewaySvc/GatewaySvc.csproj" COPY . . From cf8ade764e05cf062b37989c438cb4e301cf001a Mon Sep 17 00:00:00 2001 From: Angelo Pirola Date: Sat, 21 Dec 2024 09:43:35 +0100 Subject: [PATCH 5/5] =?UTF-8?q?Aggiunta=20nuova=20propriet=C3=A0=20statica?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/GSWCloudApp.Common/Constants/BusinessLayer.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GSWCloudApp.Common/Constants/BusinessLayer.cs b/src/GSWCloudApp.Common/Constants/BusinessLayer.cs index a213b65..a4cff01 100644 --- a/src/GSWCloudApp.Common/Constants/BusinessLayer.cs +++ b/src/GSWCloudApp.Common/Constants/BusinessLayer.cs @@ -3,7 +3,7 @@ /// /// Contains constants used in the business layer of the application. /// -public class BusinessLayer +public static class BusinessLayer { /// /// The folder where uploads are stored. @@ -25,6 +25,11 @@ public class BusinessLayer /// public static readonly string[] AllowedDocumentExtensions = [".pdf", ".txt"]; + /// + /// The allowed extensions for image uploads. + /// + public static readonly string[] AllowedImageExtensions = [".jpg", ".jpeg", ".png", ".gif"]; + /// /// The current year in UTC. ///