mirror of
https://github.com/bitwarden/server.git
synced 2025-04-26 23:32:19 -05:00

* Upgrade to Duende.Identity * Linting * Get rid of last IdentityServer4 package * Fix identity test since Duende returns additional configuration * Use Configure PostConfigure is ran after ASP.NET's PostConfigure so ConfigurationManager was already configured and our HttpHandler wasn't being respected. * Regenerate lockfiles * Move to 6.0.4 for patches * fixes with testing * Add additional grant type supported in 6.0.4 and beautify * Lockfile refresh * Reapply lockfiles * Apply change to new WebAuthn logic * When automated merging fails me --------- Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com> Co-authored-by: Kyle Spearrin <kyle.spearrin@gmail.com>
47 lines
1.7 KiB
C#
47 lines
1.7 KiB
C#
using AspNetCoreRateLimit;
|
|
using Bit.Core.Utilities;
|
|
using Microsoft.IdentityModel.Tokens;
|
|
|
|
namespace Bit.Api;
|
|
|
|
public class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
Host
|
|
.CreateDefaultBuilder(args)
|
|
.ConfigureCustomAppConfiguration(args)
|
|
.ConfigureWebHostDefaults(webBuilder =>
|
|
{
|
|
webBuilder.UseStartup<Startup>();
|
|
webBuilder.ConfigureLogging((hostingContext, logging) =>
|
|
logging.AddSerilog(hostingContext, (e, globalSettings) =>
|
|
{
|
|
var context = e.Properties["SourceContext"].ToString();
|
|
if (e.Exception != null &&
|
|
(e.Exception.GetType() == typeof(SecurityTokenValidationException) ||
|
|
e.Exception.Message == "Bad security stamp."))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (
|
|
context.Contains(typeof(IpRateLimitMiddleware).FullName))
|
|
{
|
|
return e.Level >= globalSettings.MinLogLevel.ApiSettings.IpRateLimit;
|
|
}
|
|
|
|
if (context.Contains("Duende.IdentityServer.Validation.TokenValidator") ||
|
|
context.Contains("Duende.IdentityServer.Validation.TokenRequestValidator"))
|
|
{
|
|
return e.Level >= globalSettings.MinLogLevel.ApiSettings.IdentityToken;
|
|
}
|
|
|
|
return e.Level >= globalSettings.MinLogLevel.ApiSettings.Default;
|
|
}));
|
|
})
|
|
.Build()
|
|
.Run();
|
|
}
|
|
}
|