mirror of
https://github.com/bitwarden/server.git
synced 2025-05-12 23:22:18 -05:00
Revert "Use IHttpMessageHandlerFactory For HTTP Communication"
This reverts commit c93be6d52b12599040d3c3d8a7b3bc854c6c6802.
This commit is contained in:
parent
b1efa88c6d
commit
5909f6ef8e
@ -35,7 +35,6 @@ public class DynamicAuthenticationSchemeProvider : AuthenticationSchemeProvider
|
||||
private readonly Dictionary<string, DynamicAuthenticationScheme> _cachedHandlerSchemes;
|
||||
private readonly SemaphoreSlim _semaphore;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly IHttpMessageHandlerFactory _httpMessageHandlerFactory;
|
||||
private DateTime? _lastSchemeLoad;
|
||||
private IEnumerable<DynamicAuthenticationScheme> _schemesCopy = Array.Empty<DynamicAuthenticationScheme>();
|
||||
private IEnumerable<DynamicAuthenticationScheme> _handlerSchemesCopy = Array.Empty<DynamicAuthenticationScheme>();
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
@ -493,8 +492,6 @@ public static class ServiceCollectionExtensions
|
||||
Action<AuthorizationOptions> addAuthorization)
|
||||
{
|
||||
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
// If we ever use the overload here with a different authentication scheme name then
|
||||
// we need to change the AddOptions call below.
|
||||
.AddJwtBearer(options =>
|
||||
{
|
||||
options.MapInboundClaims = false;
|
||||
@ -514,24 +511,6 @@ public static class ServiceCollectionExtensions
|
||||
};
|
||||
});
|
||||
|
||||
// This is done through a Configure method instead of above so that we can avoid
|
||||
// an early creation of services but still use a service that should centrally control how HttpMessageHandlers
|
||||
// are created.
|
||||
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();
|
||||
});
|
||||
|
||||
if (addAuthorization != null)
|
||||
{
|
||||
services.AddAuthorization(config =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user