Skip to content

Commit 8c8e90b

Browse files
authored
Merge pull request #177 from marcominerva/develop
Add new endpoint, update dependencies, and improve robustness
2 parents 283d6cb + d1bcf54 commit 8c8e90b

File tree

5 files changed

+12
-15
lines changed

5 files changed

+12
-15
lines changed

samples/MinimalApis/JwtBearerSample/Program.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@
103103
{
104104
var newToken = await jwtBearerService.RefreshTokenAsync(token, validateLifetime, expiration);
105105
return TypedResults.Ok(new LoginResponse(newToken));
106-
})
107-
.WithOpenApi();
106+
});
108107

109108
app.MapGet("api/me", (ClaimsPrincipal user) =>
110109
{

samples/MinimalApis/Net8JwtBearerSample/Net8JwtBearerSample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.22" />
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="[8.0.22,9.0.0)" />
1111
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.0.0" />
1212
</ItemGroup>
1313

src/SimpleAuthentication.Swashbuckle/SimpleAuthentication.Swashbuckle.csproj

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
<FrameworkReference Include="Microsoft.AspNetCore.App" />
3232
</ItemGroup>
3333

34+
<ItemGroup>
35+
<PackageReference Include="SimpleAuthenticationTools.Abstractions" Version="3.1.5" />
36+
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="10.0.0" />
37+
</ItemGroup>
38+
3439
<ItemGroup>
3540
<None Include="..\..\Toolbox.png">
3641
<Pack>True</Pack>
@@ -39,12 +44,4 @@
3944
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
4045
</ItemGroup>
4146

42-
<ItemGroup>
43-
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="10.0.0" />
44-
</ItemGroup>
45-
46-
<ItemGroup>
47-
<ProjectReference Include="..\SimpleAuthentication.Abstractions\SimpleAuthentication.Abstractions.csproj" />
48-
</ItemGroup>
49-
5047
</Project>

src/SimpleAuthentication.Swashbuckle/Swagger/AuthenticationOperationFilter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public async Task ApplyAsync(OpenApiOperation operation, OperationFilterContext
2222

2323
if ((requireAuthenticatedUser || requireAuthorization) && !allowAnonymous)
2424
{
25+
operation.Responses ??= [];
2526
operation.Responses.TryAdd(StatusCodes.Status401Unauthorized.ToString(), OpenApiHelpers.CreateResponse(HttpStatusCode.Unauthorized.ToString()));
2627
operation.Responses.TryAdd(StatusCodes.Status403Forbidden.ToString(), OpenApiHelpers.CreateResponse(HttpStatusCode.Forbidden.ToString()));
2728
}

src/SimpleAuthentication/SimpleAuthentication.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
3939
</ItemGroup>
4040

41+
<ItemGroup>
42+
<PackageReference Include="SimpleAuthenticationTools.Abstractions" Version="3.1.5" />
43+
</ItemGroup>
44+
4145
<ItemGroup>
4246
<None Include="..\..\Toolbox.png">
4347
<Pack>True</Pack>
@@ -46,8 +50,4 @@
4650
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
4751
</ItemGroup>
4852

49-
<ItemGroup>
50-
<ProjectReference Include="..\SimpleAuthentication.Abstractions\SimpleAuthentication.Abstractions.csproj" />
51-
</ItemGroup>
52-
5353
</Project>

0 commit comments

Comments
 (0)