Skip to content

Commit

Permalink
Update FastEndpoints package and enable JWT Bearer Auth
Browse files Browse the repository at this point in the history
The FastEndpoints package was updated to '5.20.1.7-beta' from '5.20.0-rc1'. Enabling JWT Bearer Authentication was also set from 'false' to 'true' in the SwaggerExtensions file. Removed conditions that were limiting the addition and usage of Swagger to .NET 6.0 or 7.0, which allows the Swagger to be used in any environment.
  • Loading branch information
sfmskywalker committed Dec 27, 2023
1 parent d9c1954 commit 4c11545
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
5 changes: 0 additions & 5 deletions src/bundles/Elsa.WorkflowServer.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,7 @@
}

elsa.InstallDropIns(options => options.DropInRootDirectory = Path.Combine(Directory.GetCurrentDirectory(), "App_Data", "DropIns"));

#if NET6_0 || NET7_0
elsa.AddSwagger();
#endif
});

services.AddHealthChecks();
Expand Down Expand Up @@ -271,9 +268,7 @@
// Swagger API documentation.
if (app.Environment.IsDevelopment())
{
#if NET6_0 || NET7_0
app.UseSwaggerUI();
#endif
}

// SignalR.
Expand Down
6 changes: 3 additions & 3 deletions src/common/Elsa.Api.Common/Elsa.Api.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="FastEndpoints" Version="5.20.0-rc1"/>
<PackageReference Include="FastEndpoints.Security" Version="5.20.0-rc1"/>
<!-- <PackageReference Include="FastEndpoints.Swagger" Version="5.20.0-rc1"/>--> <!-- disabled until NSwag supports .NET 8 -->
<PackageReference Include="FastEndpoints" Version="5.20.1.7-beta"/>
<PackageReference Include="FastEndpoints.Security" Version="5.20.1.7-beta"/>
<PackageReference Include="FastEndpoints.Swagger" Version="5.20.1.7-beta"/>
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 3 additions & 5 deletions src/common/Elsa.Api.Common/Extensions/SwaggerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if NET6_0 || NET7_0
using Elsa.Features.Services;
using Elsa.Features.Services;
using FastEndpoints.Swagger;
using Microsoft.AspNetCore.Builder;
using System;
Expand Down Expand Up @@ -27,7 +26,7 @@ public static IModule AddSwagger(this IModule module)
// Swagger API documentation
module.Services.SwaggerDocument(o =>
{
o.EnableJWTBearerAuth = false;
o.EnableJWTBearerAuth = true;
o.DocumentSettings = s =>
{
s.DocumentName = $"v{ver.Major}";
Expand Down Expand Up @@ -55,5 +54,4 @@ public static IApplicationBuilder UseSwaggerUI(this IApplicationBuilder app)
}

}
}
#endif
}

0 comments on commit 4c11545

Please sign in to comment.