mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 01:22:50 -05:00
upgrade to aspnet core 3.1
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
|
||||
|
||||
LABEL com.bitwarden.product="bitwarden"
|
||||
|
||||
|
@ -2,19 +2,14 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>1.33.0</Version>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<RootNamespace>Bit.Identity</RootNamespace>
|
||||
<UserSecretsId>bitwarden-Identity</UserSecretsId>
|
||||
<MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>
|
||||
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Core\Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,8 +1,8 @@
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Bit.Core.Utilities;
|
||||
using Serilog.Events;
|
||||
using AspNetCoreRateLimit;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Bit.Identity
|
||||
{
|
||||
@ -10,27 +10,30 @@ namespace Bit.Identity
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
WebHost
|
||||
Host
|
||||
.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)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
webBuilder.ConfigureLogging((hostingContext, logging) =>
|
||||
logging.AddSerilog(hostingContext, e =>
|
||||
{
|
||||
return true;
|
||||
}
|
||||
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;
|
||||
}
|
||||
if(context.Contains("IdentityServer4.Validation.TokenValidator") ||
|
||||
context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
|
||||
{
|
||||
return e.Level > LogEventLevel.Error;
|
||||
}
|
||||
|
||||
return e.Level >= LogEventLevel.Error;
|
||||
}))
|
||||
return e.Level >= LogEventLevel.Error;
|
||||
}));
|
||||
})
|
||||
.Build()
|
||||
.Run();
|
||||
}
|
||||
|
@ -8,12 +8,13 @@ using Bit.Core.Utilities;
|
||||
using AspNetCoreRateLimit;
|
||||
using System.Globalization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Bit.Identity
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IHostingEnvironment env, IConfiguration configuration)
|
||||
public Startup(IWebHostEnvironment env, IConfiguration configuration)
|
||||
{
|
||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
|
||||
Configuration = configuration;
|
||||
@ -21,7 +22,7 @@ namespace Bit.Identity
|
||||
}
|
||||
|
||||
public IConfiguration Configuration { get; private set; }
|
||||
public IHostingEnvironment Environment { get; set; }
|
||||
public IWebHostEnvironment Environment { get; set; }
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
@ -74,8 +75,8 @@ namespace Bit.Identity
|
||||
|
||||
public void Configure(
|
||||
IApplicationBuilder app,
|
||||
IHostingEnvironment env,
|
||||
IApplicationLifetime appLifetime,
|
||||
IWebHostEnvironment env,
|
||||
IHostApplicationLifetime appLifetime,
|
||||
GlobalSettings globalSettings,
|
||||
ILogger<Startup> logger)
|
||||
{
|
||||
|
Reference in New Issue
Block a user