From fa2e615eb2e7010ef07f42f374246f4d616597fb Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Thu, 31 Oct 2024 20:10:06 +0100 Subject: [PATCH] Disable SignalR and add authorization to WorkflowInstanceHub SignalR functionality is temporarily disabled until Elsa Studio sends authenticated requests. Additionally, added the [Authorize] attribute to WorkflowInstanceHub to enforce authorization on workflow events. --- src/apps/Elsa.Server.Web/Program.cs | 2 +- .../Elsa.Workflows.Api/RealTime/Hubs/WorkflowInstanceHub.cs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/apps/Elsa.Server.Web/Program.cs b/src/apps/Elsa.Server.Web/Program.cs index f84ef78ec..36855e779 100644 --- a/src/apps/Elsa.Server.Web/Program.cs +++ b/src/apps/Elsa.Server.Web/Program.cs @@ -63,7 +63,7 @@ const bool useMemoryStores = false; const bool useCaching = true; const bool useAzureServiceBus = false; const bool useReadOnlyMode = false; -const bool useSignalR = true; +const bool useSignalR = false; // Disabled until Elsa Studio sends authenticated requests. const WorkflowRuntime workflowRuntime = WorkflowRuntime.ProtoActor; const DistributedCachingTransport distributedCachingTransport = DistributedCachingTransport.ProtoActor; const MassTransitBroker massTransitBroker = MassTransitBroker.Memory; diff --git a/src/modules/Elsa.Workflows.Api/RealTime/Hubs/WorkflowInstanceHub.cs b/src/modules/Elsa.Workflows.Api/RealTime/Hubs/WorkflowInstanceHub.cs index 250da3fdd..8bf74045f 100644 --- a/src/modules/Elsa.Workflows.Api/RealTime/Hubs/WorkflowInstanceHub.cs +++ b/src/modules/Elsa.Workflows.Api/RealTime/Hubs/WorkflowInstanceHub.cs @@ -1,6 +1,7 @@ using Elsa.Workflows.Api.RealTime.Contracts; using Elsa.Workflows.Runtime; using JetBrains.Annotations; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.SignalR; namespace Elsa.Workflows.Api.RealTime.Hubs; @@ -9,6 +10,7 @@ namespace Elsa.Workflows.Api.RealTime.Hubs; /// Represents a SignalR hub for receiving workflow events on the client. /// [PublicAPI] +[Authorize] public class WorkflowInstanceHub : Hub { private readonly IWorkflowRuntime _workflowRuntime;