diff --git a/AGSS/Program.cs b/AGSS/Program.cs index 73e4532..b9c11e9 100644 --- a/AGSS/Program.cs +++ b/AGSS/Program.cs @@ -83,6 +83,17 @@ builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) ValidateIssuerSigningKey = true, IssuerSigningKey = secKey }; + x.Events = new JwtBearerEvents + { + OnChallenge = context => + { + context.HandleResponse(); + context.Response.StatusCode = 200; + context.Response.ContentType = "application/json"; + return context.Response.WriteAsJsonAsync(new ReturnTemplate(401,"你提供了一个错误的Token,所以我们无法验证你的身份,唔......",null)); + } + + }; }) .AddCookie("Identity.External").AddCookie("Identity.Application");