mirror of
https://github.com/bitwarden/server.git
synced 2025-07-05 01:52:49 -05:00
update to net core 2.2
This commit is contained in:
@ -1,5 +1,9 @@
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Bit.Core.Utilities;
|
||||
using Serilog.Events;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using AspNetCoreRateLimit;
|
||||
|
||||
namespace Bit.Api
|
||||
{
|
||||
@ -10,6 +14,29 @@ namespace Bit.Api
|
||||
WebHost
|
||||
.CreateDefaultBuilder(args)
|
||||
.UseStartup<Startup>()
|
||||
.ConfigureLogging((hostingContext, logging) =>
|
||||
logging.AddSerilog(hostingContext, e =>
|
||||
{
|
||||
var context = e.Properties["SourceContext"].ToString();
|
||||
if(e.Exception != null && (e.Exception.GetType() == typeof(SecurityTokenValidationException) ||
|
||||
e.Exception.Message == "Bad security stamp."))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(e.Level == LogEventLevel.Information && context.Contains(typeof(IpRateLimitMiddleware).FullName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(context.Contains("IdentityServer4.Validation.TokenValidator") ||
|
||||
context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
|
||||
{
|
||||
return e.Level > LogEventLevel.Error;
|
||||
}
|
||||
|
||||
return e.Level >= LogEventLevel.Error;
|
||||
}))
|
||||
.Build()
|
||||
.Run();
|
||||
}
|
||||
|
Reference in New Issue
Block a user