Skip to content

Commit 1787177

Browse files
committed
A wakeup call.
1 parent a5d42f8 commit 1787177

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

Program.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@
4545
ValidateAudience = true,
4646
ValidateIssuerSigningKey = true,
4747
};
48+
options.Events = new JwtBearerEvents
49+
{
50+
OnAuthenticationFailed = context =>
51+
{
52+
Console.WriteLine($"Auth failed: {context.Exception.GetType().Name} - {context.Exception.Message}");
53+
return Task.CompletedTask;
54+
},
55+
OnTokenValidated = context =>
56+
{
57+
return Task.CompletedTask;
58+
}
59+
};
4860
});
4961
// Add services to the container.
5062
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle

RandomAPIApp.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@
4646
</ItemGroup>
4747

4848
<ItemGroup>
49-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.1" />
49+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.15" />
5050
<PackageReference Include="Microsoft.AspNetCore.OData" Version="8.0.12" />
51-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.1" />
52-
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="6.34.0" />
51+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.15" />
52+
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.7.1" />
5353
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
5454
<PackageReference Include="OneOf" Version="3.0.271" />
5555
<PackageReference Include="Stanford.NLP.CoreNLP" Version="4.5.0" />
56-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
56+
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.4" />
5757
</ItemGroup>
5858

5959
<ItemGroup>

0 commit comments

Comments
 (0)