1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-10 04:14:41 -05:00

update to net core 2.2

This commit is contained in:
Kyle Spearrin
2019-07-23 16:38:49 -04:00
parent 3422df325b
commit 94188fa0b5
43 changed files with 227 additions and 199 deletions

View File

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1.10
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2
LABEL com.bitwarden.product="bitwarden"

View File

@ -2,10 +2,11 @@
<PropertyGroup>
<Version>1.30.4</Version>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>Bit.Identity</RootNamespace>
<UserSecretsId>bitwarden-Identity</UserSecretsId>
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
<ItemGroup>
@ -13,7 +14,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.10" />
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>

View File

@ -1,5 +1,8 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Bit.Core.Utilities;
using Serilog.Events;
using AspNetCoreRateLimit;
namespace Bit.Identity
{
@ -10,6 +13,23 @@ namespace Bit.Identity
WebHost
.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.ConfigureLogging((hostingContext, logging) =>
logging.AddSerilog(hostingContext, e =>
{
var context = e.Properties["SourceContext"].ToString();
if(context.Contains(typeof(IpRateLimitMiddleware).FullName) && e.Level == LogEventLevel.Information)
{
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();
}

View File

@ -2,11 +2,9 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;
using Bit.Core;
using Bit.Core.Utilities;
using Serilog.Events;
using AspNetCoreRateLimit;
using System.Globalization;
@ -76,26 +74,10 @@ namespace Bit.Identity
public void Configure(
IApplicationBuilder app,
IHostingEnvironment env,
ILoggerFactory loggerFactory,
IApplicationLifetime appLifetime,
GlobalSettings globalSettings)
{
loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) =>
{
var context = e.Properties["SourceContext"].ToString();
if(context.Contains(typeof(IpRateLimitMiddleware).FullName) && e.Level == LogEventLevel.Information)
{
return true;
}
if(context.Contains("IdentityServer4.Validation.TokenValidator") ||
context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
{
return e.Level > LogEventLevel.Error;
}
return e.Level >= LogEventLevel.Error;
});
app.UseSerilog(env, appLifetime, globalSettings);
// Default Middleware
app.UseDefaultMiddleware(env);