mirror of
https://github.com/bitwarden/server.git
synced 2025-04-27 15:52:13 -05:00
Add Debug Checks
This commit is contained in:
parent
31a758f687
commit
a0fe156754
@ -1,4 +1,5 @@
|
||||
using System.Net;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
@ -510,6 +511,15 @@ public static class ServiceCollectionExtensions
|
||||
services.AddOptions<JwtBearerOptions>(JwtBearerDefaults.AuthenticationScheme)
|
||||
.Configure<IHttpMessageHandlerFactory>((options, httpMessageHandlerFactory) =>
|
||||
{
|
||||
// Since we don't manually set the Backchannel and the Post stage configuration shouldn't have
|
||||
// ran yet we don't expect this option to be set. If it is set, it was likely set with a
|
||||
// handler already and won't respect the BackchannelHttpHandler we are about to set.
|
||||
Debug.Assert(options.Backchannel is null);
|
||||
|
||||
// Do a few debug checks to make sure we are customizing the expected options configured above.
|
||||
Debug.Assert(!options.TokenValidationParameters.ValidateAudience);
|
||||
Debug.Assert(options.TokenValidationParameters.ValidTypes.Single() == "at+jwt");
|
||||
Debug.Assert(options.TokenValidationParameters.NameClaimType == ClaimTypes.Email);
|
||||
options.BackchannelHttpHandler = httpMessageHandlerFactory.CreateHandler();
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user