mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
upgrade to aspnet core 3.1
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<RootNamespace>Bit.Core</RootNamespace>
|
||||
<GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
|
||||
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
|
||||
@ -24,34 +24,32 @@
|
||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
|
||||
<PackageReference Include="AWSSDK.SimpleEmail" Version="3.3.101.38" />
|
||||
<PackageReference Include="AWSSDK.SQS" Version="3.3.102" />
|
||||
<PackageReference Include="Azure.Storage.Queues" Version="12.1.0" />
|
||||
<PackageReference Include="BitPay.Light" Version="1.0.1907" />
|
||||
<PackageReference Include="Handlebars.Net" Version="1.10.1" />
|
||||
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" />
|
||||
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
|
||||
<PackageReference Include="MailKit" Version="2.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.AzureStorage" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.HttpOverrides" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.AzureStorage" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="1.0.6" />
|
||||
<PackageReference Include="Microsoft.Azure.NotificationHubs" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="3.4.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="3.1.0" />
|
||||
<PackageReference Include="Npgsql" Version="4.1.2" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.4" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.0" />
|
||||
<PackageReference Include="Quartz" Version="3.0.7" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="3.0.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" />
|
||||
<PackageReference Include="Serilog.Sinks.AzureDocumentDB" Version="3.8.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Sentry.AspNetCore" Version="2.4.2" />
|
||||
<PackageReference Include="IdentityServer4" Version="2.5.3" />
|
||||
<PackageReference Include="IdentityServer4" Version="3.1.0" />
|
||||
<PackageReference Include="Dapper" Version="1.60.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="System.Text.Json" Version="4.7.0" />
|
||||
<PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
|
||||
<PackageReference Include="AspNetCoreRateLimit" Version="2.1.0" />
|
||||
<PackageReference Include="Braintree" Version="4.15.0" />
|
||||
<PackageReference Include="Sendgrid" Version="9.12.0" />
|
||||
@ -59,7 +57,7 @@
|
||||
<PackageReference Include="U2F.Core" Version="1.0.4" />
|
||||
<PackageReference Include="Otp.NET" Version="1.2.1" />
|
||||
<PackageReference Include="YubicoDotNetClient" Version="1.2.0" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.6.1" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -24,7 +24,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
where TRole : class
|
||||
{
|
||||
// Hosting doesn't add IHttpContextAccessor by default
|
||||
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
services.AddHttpContextAccessor();
|
||||
// Identity services
|
||||
services.TryAddScoped<IUserValidator<TUser>, UserValidator<TUser>>();
|
||||
services.TryAddScoped<IPasswordValidator<TUser>, PasswordValidator<TUser>>();
|
||||
@ -34,10 +34,12 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
// No interface for the error describer so we can add errors without rev'ing the interface
|
||||
services.TryAddScoped<IdentityErrorDescriber>();
|
||||
services.TryAddScoped<ISecurityStampValidator, SecurityStampValidator<TUser>>();
|
||||
services.TryAddScoped<ITwoFactorSecurityStampValidator, TwoFactorSecurityStampValidator<TUser>>();
|
||||
services.TryAddScoped<IUserClaimsPrincipalFactory<TUser>, UserClaimsPrincipalFactory<TUser, TRole>>();
|
||||
services.TryAddScoped<UserManager<TUser>, AspNetUserManager<TUser>>();
|
||||
services.TryAddScoped<SignInManager<TUser>, SignInManager<TUser>>();
|
||||
services.TryAddScoped<RoleManager<TRole>, AspNetRoleManager<TRole>>();
|
||||
services.TryAddScoped<IUserConfirmation<TUser>, DefaultUserConfirmation<TUser>>();
|
||||
services.TryAddScoped<UserManager<TUser>>();
|
||||
services.TryAddScoped<SignInManager<TUser>>();
|
||||
services.TryAddScoped<RoleManager<TRole>>();
|
||||
|
||||
if(setupAction != null)
|
||||
{
|
||||
|
@ -4,7 +4,17 @@ namespace Bit.Core.Identity
|
||||
{
|
||||
public class LowerInvariantLookupNormalizer : ILookupNormalizer
|
||||
{
|
||||
public string Normalize(string key)
|
||||
public string NormalizeEmail(string email)
|
||||
{
|
||||
return Normalize(email);
|
||||
}
|
||||
|
||||
public string NormalizeName(string name)
|
||||
{
|
||||
return Normalize(name);
|
||||
}
|
||||
|
||||
private string Normalize(string key)
|
||||
{
|
||||
return key?.Normalize().ToLowerInvariant();
|
||||
}
|
||||
|
@ -22,8 +22,9 @@ namespace Bit.Core.Identity
|
||||
IOptions<IdentityOptions> optionsAccessor,
|
||||
ILogger<SignInManager<TUser>> logger,
|
||||
IAuthenticationSchemeProvider schemes,
|
||||
IUserConfirmation<TUser> confirmation,
|
||||
IMailService mailService)
|
||||
: base(userManager, contextAccessor, claimsFactory, optionsAccessor, logger, schemes)
|
||||
: base(userManager, contextAccessor, claimsFactory, optionsAccessor, logger, schemes, confirmation)
|
||||
{
|
||||
_mailService = mailService;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Bit.Core.Models.Table;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Bit.Core.Identity
|
||||
{
|
||||
@ -9,8 +10,9 @@ namespace Bit.Core.Identity
|
||||
{
|
||||
public TwoFactorRememberTokenProvider(
|
||||
IDataProtectionProvider dataProtectionProvider,
|
||||
IOptions<TwoFactorRememberTokenProviderOptions> options)
|
||||
: base(dataProtectionProvider, options)
|
||||
IOptions<TwoFactorRememberTokenProviderOptions> options,
|
||||
ILogger<DataProtectorTokenProvider<User>> logger)
|
||||
: base(dataProtectionProvider, options, logger)
|
||||
{ }
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.WindowsAzure.Storage.Table;
|
||||
using Microsoft.Azure.Cosmos.Table;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
|
@ -2,8 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.WindowsAzure.Storage.Table;
|
||||
using Microsoft.Azure.Cosmos.Table;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using Microsoft.WindowsAzure.Storage.Table;
|
||||
using Microsoft.Azure.Cosmos.Table;
|
||||
|
||||
namespace Bit.Core.Models.Data
|
||||
{
|
||||
|
@ -5,8 +5,7 @@ using System.Threading.Tasks;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.WindowsAzure.Storage.Table;
|
||||
using Microsoft.Azure.Cosmos.Table;
|
||||
|
||||
namespace Bit.Core.Repositories.TableStorage
|
||||
{
|
||||
|
@ -3,8 +3,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Models.Data;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.WindowsAzure.Storage.Table;
|
||||
using Microsoft.Azure.Cosmos.Table;
|
||||
|
||||
namespace Bit.Core.Repositories.TableStorage
|
||||
{
|
||||
|
@ -3,8 +3,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Models.Data;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.WindowsAzure.Storage.Table;
|
||||
using Microsoft.Azure.Cosmos.Table;
|
||||
|
||||
namespace Bit.Core.Repositories.TableStorage
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.WindowsAzure.Storage.Blob;
|
||||
using Microsoft.Azure.Storage;
|
||||
using Microsoft.Azure.Storage.Blob;
|
||||
using System.IO;
|
||||
using System;
|
||||
using Bit.Core.Models.Table;
|
||||
|
@ -1,31 +1,24 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.WindowsAzure.Storage.Queue;
|
||||
using System;
|
||||
using Bit.Core.Utilities;
|
||||
using Azure.Storage.Queues;
|
||||
|
||||
namespace Bit.Core.Services
|
||||
{
|
||||
public class AzureQueueBlockIpService : IBlockIpService
|
||||
{
|
||||
private readonly CloudQueue _blockIpQueue;
|
||||
private readonly CloudQueue _unblockIpQueue;
|
||||
private bool _didInit = false;
|
||||
private readonly QueueClient _blockIpQueueClient;
|
||||
private readonly QueueClient _unblockIpQueueClient;
|
||||
private Tuple<string, bool, DateTime> _lastBlock;
|
||||
|
||||
public AzureQueueBlockIpService(
|
||||
GlobalSettings globalSettings)
|
||||
{
|
||||
var storageAccount = CloudStorageAccount.Parse(globalSettings.Storage.ConnectionString);
|
||||
var queueClient = storageAccount.CreateCloudQueueClient();
|
||||
|
||||
_blockIpQueue = queueClient.GetQueueReference("blockip");
|
||||
_unblockIpQueue = queueClient.GetQueueReference("unblockip");
|
||||
_blockIpQueueClient = new QueueClient(globalSettings.Storage.ConnectionString, "blockip");
|
||||
_unblockIpQueueClient = new QueueClient(globalSettings.Storage.ConnectionString, "unblockip");
|
||||
}
|
||||
|
||||
public async Task BlockIpAsync(string ipAddress, bool permanentBlock)
|
||||
{
|
||||
await InitAsync();
|
||||
var now = DateTime.UtcNow;
|
||||
if(_lastBlock != null && _lastBlock.Item1 == ipAddress && _lastBlock.Item2 == permanentBlock &&
|
||||
(now - _lastBlock.Item3) < TimeSpan.FromMinutes(1))
|
||||
@ -35,24 +28,11 @@ namespace Bit.Core.Services
|
||||
}
|
||||
|
||||
_lastBlock = new Tuple<string, bool, DateTime>(ipAddress, permanentBlock, now);
|
||||
var message = new CloudQueueMessage(ipAddress);
|
||||
await _blockIpQueue.AddMessageAsync(message);
|
||||
await _blockIpQueueClient.SendMessageAsync(ipAddress);
|
||||
if(!permanentBlock)
|
||||
{
|
||||
await _unblockIpQueue.AddMessageAsync(message, null, new TimeSpan(0, 15, 0), null, null);
|
||||
await _unblockIpQueueClient.SendMessageAsync(ipAddress, new TimeSpan(0, 15, 0));
|
||||
}
|
||||
}
|
||||
|
||||
private async Task InitAsync()
|
||||
{
|
||||
if(_didInit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await _blockIpQueue.CreateIfNotExistsAsync();
|
||||
await _unblockIpQueue.CreateIfNotExistsAsync();
|
||||
_didInit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Repositories;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.WindowsAzure.Storage.Queue;
|
||||
using Azure.Storage.Queues;
|
||||
using Newtonsoft.Json;
|
||||
using Bit.Core.Models.Data;
|
||||
|
||||
@ -10,8 +8,7 @@ namespace Bit.Core.Services
|
||||
{
|
||||
public class AzureQueueEventWriteService : IEventWriteService
|
||||
{
|
||||
private readonly CloudQueue _queue;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly QueueClient _queueClient;
|
||||
|
||||
private JsonSerializerSettings _jsonSettings = new JsonSerializerSettings
|
||||
{
|
||||
@ -19,28 +16,21 @@ namespace Bit.Core.Services
|
||||
};
|
||||
|
||||
public AzureQueueEventWriteService(
|
||||
IEventRepository eventRepository,
|
||||
GlobalSettings globalSettings)
|
||||
{
|
||||
var storageAccount = CloudStorageAccount.Parse(globalSettings.Events.ConnectionString);
|
||||
var queueClient = storageAccount.CreateCloudQueueClient();
|
||||
|
||||
_queue = queueClient.GetQueueReference("event");
|
||||
_globalSettings = globalSettings;
|
||||
_queueClient = new QueueClient(globalSettings.Events.ConnectionString, "event");
|
||||
}
|
||||
|
||||
public async Task CreateAsync(IEvent e)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(e, _jsonSettings);
|
||||
var message = new CloudQueueMessage(json);
|
||||
await _queue.AddMessageAsync(message);
|
||||
await _queueClient.SendMessageAsync(json);
|
||||
}
|
||||
|
||||
public async Task CreateManyAsync(IList<IEvent> e)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(e, _jsonSettings);
|
||||
var message = new CloudQueueMessage(json);
|
||||
await _queue.AddMessageAsync(message);
|
||||
await _queueClient.SendMessageAsync(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,7 @@ using Bit.Core.Models.Table;
|
||||
using Bit.Core.Enums;
|
||||
using Newtonsoft.Json;
|
||||
using Bit.Core.Models;
|
||||
using Microsoft.WindowsAzure.Storage.Queue;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Azure.Storage.Queues;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@ -13,7 +12,7 @@ namespace Bit.Core.Services
|
||||
{
|
||||
public class AzureQueuePushNotificationService : IPushNotificationService
|
||||
{
|
||||
private readonly CloudQueue _queue;
|
||||
private readonly QueueClient _queueClient;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
@ -26,9 +25,7 @@ namespace Bit.Core.Services
|
||||
GlobalSettings globalSettings,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
var storageAccount = CloudStorageAccount.Parse(globalSettings.Notifications.ConnectionString);
|
||||
var queueClient = storageAccount.CreateCloudQueueClient();
|
||||
_queue = queueClient.GetQueueReference("notifications");
|
||||
_queueClient = new QueueClient(globalSettings.Notifications.ConnectionString, "notifications");
|
||||
_globalSettings = globalSettings;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
@ -143,8 +140,7 @@ namespace Bit.Core.Services
|
||||
var contextId = GetContextIdentifier(excludeCurrentContext);
|
||||
var message = JsonConvert.SerializeObject(new PushNotificationData<T>(type, payload, contextId),
|
||||
_jsonSettings);
|
||||
var queueMessage = new CloudQueueMessage(message);
|
||||
await _queue.AddMessageAsync(queueMessage);
|
||||
await _queueClient.SendMessageAsync(message);
|
||||
}
|
||||
|
||||
private string GetContextIdentifier(bool excludeCurrentContext)
|
||||
|
@ -4,7 +4,7 @@ using Bit.Core.Repositories;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.Azure.Storage;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -16,7 +16,8 @@ using System.Web;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Bit.Core.Enums;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.Azure.Storage;
|
||||
using Microsoft.Azure.Storage.Blob;
|
||||
|
||||
namespace Bit.Core.Utilities
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
@ -12,8 +13,8 @@ namespace Bit.Core.Utilities
|
||||
{
|
||||
public static void UseSerilog(
|
||||
this IApplicationBuilder appBuilder,
|
||||
IHostingEnvironment env,
|
||||
IApplicationLifetime applicationLifetime,
|
||||
IWebHostEnvironment env,
|
||||
IHostApplicationLifetime applicationLifetime,
|
||||
GlobalSettings globalSettings)
|
||||
{
|
||||
if(env.IsDevelopment())
|
||||
|
@ -15,7 +15,6 @@ using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using System;
|
||||
using System.IO;
|
||||
using SqlServerRepos = Bit.Core.Repositories.SqlServer;
|
||||
@ -34,6 +33,9 @@ using System.Security.Cryptography.X509Certificates;
|
||||
using Bit.Core.Utilities;
|
||||
using Serilog.Context;
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Azure.Storage;
|
||||
|
||||
namespace Bit.Core.Utilities
|
||||
{
|
||||
@ -41,11 +43,22 @@ namespace Bit.Core.Utilities
|
||||
{
|
||||
public static void AddSqlServerRepositories(this IServiceCollection services, GlobalSettings globalSettings)
|
||||
{
|
||||
if(!string.IsNullOrWhiteSpace(globalSettings.PostgreSql?.ConnectionString))
|
||||
var usePostgreSql = !string.IsNullOrWhiteSpace(globalSettings.PostgreSql?.ConnectionString);
|
||||
var useEf = usePostgreSql;
|
||||
|
||||
if(useEf)
|
||||
{
|
||||
services.AddAutoMapper(typeof(EntityFrameworkRepos.UserRepository));
|
||||
services.AddDbContext<EntityFrameworkRepos.DatabaseContext>();
|
||||
services.AddDbContext<EntityFrameworkRepos.DatabaseContext>(options =>
|
||||
{
|
||||
if(usePostgreSql)
|
||||
{
|
||||
options.UseNpgsql(globalSettings.PostgreSql.ConnectionString);
|
||||
}
|
||||
});
|
||||
services.AddSingleton<IUserRepository, EntityFrameworkRepos.UserRepository>();
|
||||
//services.AddSingleton<ICipherRepository, EntityFrameworkRepos.CipherRepository>();
|
||||
//services.AddSingleton<IOrganizationRepository, EntityFrameworkRepos.OrganizationRepository>();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -67,7 +80,14 @@ namespace Bit.Core.Utilities
|
||||
|
||||
if(globalSettings.SelfHosted)
|
||||
{
|
||||
services.AddSingleton<IEventRepository, SqlServerRepos.EventRepository>();
|
||||
if(useEf)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
services.AddSingleton<IEventRepository, SqlServerRepos.EventRepository>();
|
||||
}
|
||||
services.AddSingleton<IInstallationDeviceRepository, NoopRepos.InstallationDeviceRepository>();
|
||||
services.AddSingleton<IMetaDataRepository, NoopRepos.MetaDataRepository>();
|
||||
}
|
||||
@ -283,7 +303,7 @@ namespace Bit.Core.Utilities
|
||||
}
|
||||
|
||||
public static void AddIdentityAuthenticationServices(
|
||||
this IServiceCollection services, GlobalSettings globalSettings, IHostingEnvironment environment,
|
||||
this IServiceCollection services, GlobalSettings globalSettings, IWebHostEnvironment environment,
|
||||
Action<AuthorizationOptions> addAuthorization)
|
||||
{
|
||||
services
|
||||
@ -313,7 +333,7 @@ namespace Bit.Core.Utilities
|
||||
}
|
||||
|
||||
public static IIdentityServerBuilder AddCustomIdentityServerServices(
|
||||
this IServiceCollection services, IHostingEnvironment env, GlobalSettings globalSettings)
|
||||
this IServiceCollection services, IWebHostEnvironment env, GlobalSettings globalSettings)
|
||||
{
|
||||
var issuerUri = new Uri(globalSettings.BaseServiceUri.InternalIdentity);
|
||||
var identityServerBuilder = services
|
||||
@ -373,7 +393,7 @@ namespace Bit.Core.Utilities
|
||||
}
|
||||
|
||||
public static void AddCustomDataProtectionServices(
|
||||
this IServiceCollection services, IHostingEnvironment env, GlobalSettings globalSettings)
|
||||
this IServiceCollection services, IWebHostEnvironment env, GlobalSettings globalSettings)
|
||||
{
|
||||
if(env.IsDevelopment())
|
||||
{
|
||||
@ -417,7 +437,7 @@ namespace Bit.Core.Utilities
|
||||
}
|
||||
|
||||
public static void UseDefaultMiddleware(this IApplicationBuilder app,
|
||||
IHostingEnvironment env, GlobalSettings globalSettings)
|
||||
IWebHostEnvironment env, GlobalSettings globalSettings)
|
||||
{
|
||||
string GetHeaderValue(HttpContext httpContext, string header)
|
||||
{
|
||||
|
Reference in New Issue
Block a user