Merge branch 'master' into feature/user-actions-changes
This commit is contained in:
commit
a9f64e474f
@ -28,6 +28,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
@ -93,7 +94,6 @@ namespace ASC.Security.Cryptography
|
||||
services.TryAddSingleton<InstanceCrypto>();
|
||||
|
||||
return services
|
||||
.AddHttpContextAccessor()
|
||||
.AddMachinePseudoKeysService();
|
||||
}
|
||||
}
|
||||
|
@ -164,7 +164,36 @@ namespace ASC.Core.Billing
|
||||
{
|
||||
CacheExpiration = DEFAULT_CACHE_EXPIRATION;
|
||||
}
|
||||
|
||||
|
||||
public TariffService(
|
||||
IQuotaService quotaService,
|
||||
ITenantService tenantService,
|
||||
CoreBaseSettings coreBaseSettings,
|
||||
CoreSettings coreSettings,
|
||||
IConfiguration configuration,
|
||||
DbContextManager<CoreDbContext> coreDbContextManager,
|
||||
TariffServiceStorage tariffServiceStorage,
|
||||
IOptionsMonitor<ILog> options)
|
||||
: this()
|
||||
|
||||
{
|
||||
Log = options.CurrentValue;
|
||||
QuotaService = quotaService;
|
||||
TenantService = tenantService;
|
||||
CoreSettings = coreSettings;
|
||||
Configuration = configuration;
|
||||
TariffServiceStorage = tariffServiceStorage;
|
||||
Options = options;
|
||||
CoreBaseSettings = coreBaseSettings;
|
||||
Test = configuration["core:payment:test"] == "true";
|
||||
int.TryParse(configuration["core:payment:delay"], out var paymentDelay);
|
||||
|
||||
PaymentDelay = paymentDelay;
|
||||
|
||||
Cache = TariffServiceStorage.Cache;
|
||||
Notify = TariffServiceStorage.Notify;
|
||||
CoreDbContext = coreDbContextManager.Value;
|
||||
}
|
||||
|
||||
public Tariff GetTariff(int tenantId, bool withRequestToPaymentSystem = true)
|
||||
{
|
||||
@ -664,6 +693,7 @@ namespace ASC.Core.Billing
|
||||
|
||||
services.TryAddSingleton<TariffServiceStorage>();
|
||||
|
||||
services.TryAddScoped<ITariffService, TariffService>();
|
||||
services.TryAddScoped<IConfigureOptions<TariffService>, ConfigureTariffService>();
|
||||
|
||||
return services;
|
||||
|
@ -108,7 +108,7 @@ namespace ASC.Core.Caching
|
||||
}
|
||||
}
|
||||
|
||||
public class CachedQuotaService : IQuotaService
|
||||
class CachedQuotaService : IQuotaService
|
||||
{
|
||||
internal IQuotaService Service { get; set; }
|
||||
internal ICache Cache { get; set; }
|
||||
@ -122,9 +122,16 @@ namespace ASC.Core.Caching
|
||||
{
|
||||
Interval = new TrustInterval();
|
||||
CacheExpiration = TimeSpan.FromMinutes(10);
|
||||
}
|
||||
|
||||
public CachedQuotaService(DbQuotaService service, QuotaServiceCache quotaServiceCache) : this()
|
||||
{
|
||||
Service = service ?? throw new ArgumentNullException("service");
|
||||
QuotaServiceCache = quotaServiceCache;
|
||||
Cache = quotaServiceCache.Cache;
|
||||
CacheNotify = quotaServiceCache.CacheNotify;
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<TenantQuota> GetTenantQuotas()
|
||||
{
|
||||
var quotas = Cache.Get<IEnumerable<TenantQuota>>(QuotaServiceCache.KEY_QUOTA);
|
||||
@ -240,6 +247,7 @@ namespace ASC.Core.Caching
|
||||
|
||||
services.TryAddSingleton(typeof(ICacheNotify<>), typeof(KafkaCache<>));
|
||||
services.TryAddSingleton<QuotaServiceCache>();
|
||||
|
||||
services.TryAddScoped<DbQuotaService>();
|
||||
services.TryAddScoped<IQuotaService, CachedQuotaService>();
|
||||
|
||||
|
@ -181,7 +181,7 @@ namespace ASC.Core.Caching
|
||||
}
|
||||
}
|
||||
|
||||
public class CachedTenantService : ITenantService
|
||||
class CachedTenantService : ITenantService
|
||||
{
|
||||
internal ITenantService Service { get; set; }
|
||||
|
||||
@ -196,9 +196,16 @@ namespace ASC.Core.Caching
|
||||
{
|
||||
cache = AscCache.Memory;
|
||||
SettingsExpiration = TimeSpan.FromMinutes(2);
|
||||
}
|
||||
|
||||
public CachedTenantService(DbTenantService service, TenantServiceCache tenantServiceCache) : this()
|
||||
{
|
||||
Service = service ?? throw new ArgumentNullException("service");
|
||||
TenantServiceCache = tenantServiceCache;
|
||||
CacheNotifyItem = tenantServiceCache.CacheNotifyItem;
|
||||
CacheNotifySettings = tenantServiceCache.CacheNotifySettings;
|
||||
}
|
||||
|
||||
|
||||
public void ValidateDomain(string domain)
|
||||
{
|
||||
Service.ValidateDomain(domain);
|
||||
@ -306,6 +313,9 @@ namespace ASC.Core.Caching
|
||||
services.TryAddSingleton<TimeZoneConverter>();
|
||||
services.TryAddSingleton<TenantServiceCache>();
|
||||
|
||||
services.TryAddScoped<DbTenantService>();
|
||||
services.TryAddScoped<ITenantService, CachedTenantService>();
|
||||
|
||||
services.TryAddScoped<IConfigureOptions<DbTenantService>, ConfigureDbTenantService>();
|
||||
services.TryAddScoped<IConfigureOptions<CachedTenantService>, ConfigureCachedTenantService>();
|
||||
|
||||
|
@ -42,7 +42,7 @@ using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Core.Caching
|
||||
{
|
||||
class UserServiceCache
|
||||
public class UserServiceCache
|
||||
{
|
||||
public const string USERS = "users";
|
||||
private const string GROUPS = "groups";
|
||||
@ -196,8 +196,24 @@ namespace ASC.Core.Caching
|
||||
CacheExpiration = TimeSpan.FromMinutes(20);
|
||||
DbExpiration = TimeSpan.FromMinutes(1);
|
||||
PhotoExpiration = TimeSpan.FromMinutes(10);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CachedUserService(
|
||||
EFUserService service,
|
||||
CoreBaseSettings coreBaseSettings,
|
||||
UserServiceCache userServiceCache
|
||||
) : this()
|
||||
{
|
||||
Service = service ?? throw new ArgumentNullException("service");
|
||||
CoreBaseSettings = coreBaseSettings;
|
||||
UserServiceCache = userServiceCache;
|
||||
Cache = userServiceCache.Cache;
|
||||
CacheUserInfoItem = userServiceCache.CacheUserInfoItem;
|
||||
CacheUserPhotoItem = userServiceCache.CacheUserPhotoItem;
|
||||
CacheGroupCacheItem = userServiceCache.CacheGroupCacheItem;
|
||||
CacheUserGroupRefItem = userServiceCache.CacheUserGroupRefItem;
|
||||
TrustInterval = userServiceCache.TrustInterval;
|
||||
}
|
||||
|
||||
public IDictionary<Guid, UserInfo> GetUsers(int tenant, DateTime from)
|
||||
{
|
||||
@ -508,6 +524,9 @@ namespace ASC.Core.Caching
|
||||
.AddLoggerService()
|
||||
.AddUserDbContextService();
|
||||
|
||||
services.TryAddScoped<EFUserService>();
|
||||
services.TryAddScoped<IUserService, CachedUserService>();
|
||||
|
||||
services.TryAddScoped<IConfigureOptions<EFUserService>, ConfigureEFUserService>();
|
||||
services.TryAddScoped<IConfigureOptions<CachedUserService>, ConfigureCachedUserService>();
|
||||
|
||||
|
@ -35,7 +35,6 @@ using ASC.Core.Users;
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Core
|
||||
{
|
||||
@ -46,9 +45,9 @@ namespace ASC.Core
|
||||
public UserManager UserManager { get; }
|
||||
public UserFormatter UserFormatter { get; }
|
||||
|
||||
public AuthManager(IOptionsSnapshot<CachedUserService> service, UserManager userManager, UserFormatter userFormatter)
|
||||
public AuthManager(IUserService service, UserManager userManager, UserFormatter userFormatter)
|
||||
{
|
||||
userService = service.Value;
|
||||
userService = service;
|
||||
UserManager = userManager;
|
||||
UserFormatter = userFormatter;
|
||||
}
|
||||
|
@ -148,11 +148,11 @@ namespace ASC.Core
|
||||
}
|
||||
|
||||
public CoreSettings(
|
||||
IOptionsSnapshot<CachedTenantService> tenantService,
|
||||
ITenantService tenantService,
|
||||
CoreBaseSettings coreBaseSettings,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
TenantService = tenantService.Value;
|
||||
TenantService = tenantService;
|
||||
CoreBaseSettings = coreBaseSettings;
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ using Microsoft.AspNetCore.WebUtilities;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@ -57,10 +56,10 @@ namespace ASC.Core
|
||||
public TenantManager TenantManager { get; }
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
public PaymentManager(TenantManager tenantManager, IOptionsSnapshot<TariffService> tariffService, IConfiguration configuration)
|
||||
public PaymentManager(TenantManager tenantManager, ITariffService tariffService, IConfiguration configuration)
|
||||
{
|
||||
TenantManager = tenantManager;
|
||||
this.tariffService = tariffService.Value;
|
||||
this.tariffService = tariffService;
|
||||
Configuration = configuration;
|
||||
partnerUrl = (Configuration["core:payment:partners"] ?? "https://partners.onlyoffice.com/api").TrimEnd('/');
|
||||
partnerKey = (Configuration["core:machinekey"] ?? "C5C1F4E85A3A43F5B3202C24D97351DF");
|
||||
|
@ -96,7 +96,8 @@ namespace ASC.Core
|
||||
public const string CURRENT_TENANT = "CURRENT_TENANT";
|
||||
internal ITenantService TenantService { get; set; }
|
||||
internal IQuotaService QuotaService { get; set; }
|
||||
internal ITariffService TariffService { get; set; }
|
||||
internal ITariffService TariffService { get; set; }
|
||||
|
||||
private static List<string> thisCompAddresses = new List<string>();
|
||||
|
||||
internal HttpContext HttpContext { get; set; }
|
||||
@ -124,16 +125,16 @@ namespace ASC.Core
|
||||
}
|
||||
|
||||
public TenantManager(
|
||||
IOptionsSnapshot<CachedTenantService> tenantService,
|
||||
IOptionsSnapshot<CachedQuotaService> quotaService,
|
||||
IOptionsSnapshot<TariffService> tariffService,
|
||||
ITenantService tenantService,
|
||||
IQuotaService quotaService,
|
||||
ITariffService tariffService,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
CoreBaseSettings coreBaseSettings,
|
||||
CoreSettings coreSettings)
|
||||
{
|
||||
TenantService = tenantService.Value;
|
||||
QuotaService = quotaService.Value;
|
||||
TariffService = tariffService.Value;
|
||||
TenantService = tenantService;
|
||||
QuotaService = quotaService;
|
||||
TariffService = tariffService;
|
||||
CoreBaseSettings = coreBaseSettings;
|
||||
CoreSettings = coreSettings;
|
||||
HttpContext = httpContextAccessor?.HttpContext;
|
||||
@ -345,7 +346,6 @@ namespace ASC.Core
|
||||
services.TryAddScoped<IConfigureOptions<TenantManager>, ConfigureTenantManager>();
|
||||
|
||||
return services
|
||||
.AddHttpContextAccessor()
|
||||
.AddTenantService()
|
||||
.AddQuotaService()
|
||||
.AddTariffService()
|
||||
|
@ -36,7 +36,6 @@ using ASC.Core.Users;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Core
|
||||
{
|
||||
@ -70,13 +69,13 @@ namespace ASC.Core
|
||||
private Tenant Tenant { get { return tenant ?? (tenant = TenantManager.GetCurrentTenant()); } }
|
||||
|
||||
public UserManager(
|
||||
IOptionsSnapshot<CachedUserService> service,
|
||||
IUserService service,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
TenantManager tenantManager,
|
||||
PermissionContext permissionContext,
|
||||
UserManagerConstants userManagerConstants)
|
||||
{
|
||||
UserService = service.Value;
|
||||
UserService = service;
|
||||
Accessor = httpContextAccessor;
|
||||
TenantManager = tenantManager;
|
||||
PermissionContext = permissionContext;
|
||||
@ -642,7 +641,6 @@ namespace ASC.Core
|
||||
|
||||
return services
|
||||
.AddUserService()
|
||||
.AddHttpContextAccessor()
|
||||
.AddTenantManagerService()
|
||||
.AddConstantsService()
|
||||
.AddPermissionContextService();
|
||||
|
@ -32,6 +32,7 @@ using System.Security.Authentication;
|
||||
using System.Security.Claims;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Security;
|
||||
using ASC.Common.Security.Authentication;
|
||||
@ -43,6 +44,7 @@ using ASC.Core.Security.Authorizing;
|
||||
using ASC.Core.Tenants;
|
||||
using ASC.Core.Users;
|
||||
using ASC.Security.Cryptography;
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
@ -357,14 +359,12 @@ namespace ASC.Core
|
||||
.AddUserFormatter()
|
||||
.AddAuthContextService()
|
||||
.AddUserManagerService()
|
||||
.AddTenantManagerService()
|
||||
.AddHttpContextAccessor();
|
||||
.AddTenantManagerService();
|
||||
}
|
||||
public static IServiceCollection AddAuthContextService(this IServiceCollection services)
|
||||
{
|
||||
services.TryAddScoped<AuthContext>();
|
||||
return services
|
||||
.AddHttpContextAccessor();
|
||||
return services;
|
||||
}
|
||||
|
||||
public static IServiceCollection AddPermissionContextService(this IServiceCollection services)
|
||||
|
@ -86,7 +86,12 @@ namespace ASC.Core.Data
|
||||
Tag = r.Tag,
|
||||
Tenant = r.Tenant
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public DbQuotaService(DbContextManager<CoreDbContext> dbContextManager) : this()
|
||||
{
|
||||
CoreDbContext = dbContextManager.Value;
|
||||
}
|
||||
|
||||
public IEnumerable<TenantQuota> GetTenantQuotas()
|
||||
{
|
||||
|
@ -107,9 +107,14 @@ namespace ASC.Core.Data
|
||||
|
||||
var fromDbTenantToTenant = FromDbTenantToTenant.Compile();
|
||||
FromTenantUserToTenant = r => fromDbTenantToTenant(r.DbTenant);
|
||||
}
|
||||
|
||||
public DbTenantService(DbContextManager<TenantDbContext> dbContextManager, TenantDomainValidator tenantDomainValidator) : this()
|
||||
{
|
||||
TenantDbContext = dbContextManager.Value;
|
||||
TenantDomainValidator = tenantDomainValidator;
|
||||
}
|
||||
|
||||
|
||||
public void ValidateDomain(string domain)
|
||||
{
|
||||
using var tr = TenantDbContext.Database.BeginTransaction();
|
||||
|
@ -182,6 +182,12 @@ namespace ASC.Core.Data
|
||||
};
|
||||
}
|
||||
|
||||
public EFUserService(DbContextManager<UserDbContext> userDbContextManager) : this()
|
||||
{
|
||||
UserDbContextManager = userDbContextManager;
|
||||
UserDbContext = UserDbContextManager.Value;
|
||||
}
|
||||
|
||||
public Group GetGroup(int tenant, Guid id)
|
||||
{
|
||||
return GetGroupQuery(UserDbContext, tenant, default)
|
||||
|
@ -42,7 +42,7 @@ using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Core
|
||||
{
|
||||
public class ConfigureHostedSolution : IConfigureNamedOptions<HostedSolution>
|
||||
class ConfigureHostedSolution : IConfigureNamedOptions<HostedSolution>
|
||||
{
|
||||
public UserFormatter UserFormatter { get; }
|
||||
public IOptionsSnapshot<CachedTenantService> TenantService { get; }
|
||||
|
@ -27,8 +27,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using ASC.Common.Threading.Progress;
|
||||
using ASC.Core.Users;
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
@ -148,8 +150,7 @@ namespace ASC.Data.Reassigns
|
||||
services.AddSingleton<IConfigureOptions<ProgressQueue<RemoveProgressItem>>, ConfigureProgressQueue<RemoveProgressItem>>();
|
||||
services.TryAddScoped<QueueWorkerRemove>();
|
||||
|
||||
return services
|
||||
.AddHttpContextAccessor();
|
||||
return services;
|
||||
}
|
||||
public static IServiceCollection AddQueueWorkerReassignService(this IServiceCollection services)
|
||||
{
|
||||
@ -159,8 +160,7 @@ namespace ASC.Data.Reassigns
|
||||
services.TryAddScoped<QueueWorkerReassign>();
|
||||
|
||||
return services
|
||||
.AddQueueWorkerRemoveService()
|
||||
.AddHttpContextAccessor();
|
||||
.AddQueueWorkerRemoveService();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -214,8 +214,7 @@ namespace ASC.Data.Storage.Configuration
|
||||
return services
|
||||
.AddStorageFactoryConfigService()
|
||||
.AddPathUtilsService()
|
||||
.AddEmailValidationKeyProviderService()
|
||||
.AddHttpContextAccessor();
|
||||
.AddEmailValidationKeyProviderService();
|
||||
}
|
||||
|
||||
public static IServiceCollection AddCdnStorageSettingsService(this IServiceCollection services)
|
||||
|
@ -328,7 +328,6 @@ namespace ASC.Data.Storage
|
||||
.AddCoreBaseSettingsService()
|
||||
.AddPathUtilsService()
|
||||
.AddEmailValidationKeyProviderService()
|
||||
.AddHttpContextAccessor()
|
||||
.AddStorageSettingsService()
|
||||
.AddStorageFactoryConfigService();
|
||||
}
|
||||
|
@ -243,8 +243,7 @@ namespace ASC.Data.Storage
|
||||
.AddStaticUploaderService()
|
||||
.AddCdnStorageSettingsService()
|
||||
.AddWebPathSettingsService()
|
||||
.AddCoreBaseSettingsService()
|
||||
.AddHttpContextAccessor();
|
||||
.AddCoreBaseSettingsService();
|
||||
}
|
||||
public static IServiceCollection AddWebPathSettingsService(this IServiceCollection services)
|
||||
{
|
||||
|
@ -28,9 +28,11 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.Settings;
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
@ -150,7 +152,6 @@ namespace ASC.IPSecurity
|
||||
return services
|
||||
.AddIPRestrictionsService()
|
||||
.AddSettingsManagerService()
|
||||
.AddHttpContextAccessor()
|
||||
.AddAuthContextService()
|
||||
.AddTenantManagerService();
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ using System.Linq;
|
||||
|
||||
using ASC.Common.Logging;
|
||||
using ASC.MessagingSystem.DbSender;
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -295,7 +296,6 @@ namespace ASC.MessagingSystem
|
||||
|
||||
return services
|
||||
.AddMessagePolicyService()
|
||||
.AddHttpContextAccessor()
|
||||
.AddDbMessageSenderService()
|
||||
.AddMessageFactoryService();
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ namespace ASC.Studio.Notify
|
||||
})
|
||||
.ConfigureServices((hostContext, services) =>
|
||||
{
|
||||
services.AddHttpContextAccessor();
|
||||
services.AddNLogManager("ASC.Notify", "ASC.Notify.Messages");
|
||||
services.AddHostedService<ServiceLauncher>();
|
||||
services.AddServiceLauncher();
|
||||
|
@ -42,22 +42,17 @@ namespace ASC.People
|
||||
{
|
||||
services.AddHttpContextAccessor();
|
||||
|
||||
services.AddControllers().AddControllersAsServices()
|
||||
.AddNewtonsoftJson()
|
||||
.AddXmlSerializerFormatters();
|
||||
services.AddControllers()
|
||||
.AddNewtonsoftJson()
|
||||
.AddXmlSerializerFormatters();
|
||||
|
||||
services.AddTransient<IConfigureOptions<MvcNewtonsoftJsonOptions>, CustomJsonOptionsWrapper>();
|
||||
|
||||
services.AddMemoryCache();
|
||||
|
||||
services.AddDistributedMemoryCache();
|
||||
services.AddSession();
|
||||
|
||||
services.AddAuthentication("cookie")
|
||||
.AddScheme<AuthenticationSchemeOptions, CookieAuthHandler>("cookie", a => { })
|
||||
.AddScheme<AuthenticationSchemeOptions, ConfirmAuthHandler>("confirm", a => { });
|
||||
.AddScheme<AuthenticationSchemeOptions, CookieAuthHandler>("cookie", a => { })
|
||||
.AddScheme<AuthenticationSchemeOptions, ConfirmAuthHandler>("confirm", a => { });
|
||||
|
||||
var builder = services.AddMvc(config =>
|
||||
var builder = services.AddMvcCore(config =>
|
||||
{
|
||||
var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build();
|
||||
config.Filters.Add(new AuthorizeFilter(policy));
|
||||
@ -73,6 +68,7 @@ namespace ASC.People
|
||||
config.OutputFormatters.Add(new XmlOutputFormatter());
|
||||
});
|
||||
|
||||
|
||||
services
|
||||
.AddConfirmAuthHandler()
|
||||
.AddCookieAuthHandler()
|
||||
@ -137,8 +133,6 @@ namespace ASC.People
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseSession();
|
||||
|
||||
app.UseAuthentication();
|
||||
|
||||
app.UseAuthorization();
|
||||
@ -152,8 +146,6 @@ namespace ASC.People
|
||||
endpoints.MapControllers();
|
||||
endpoints.MapCustom();
|
||||
});
|
||||
|
||||
app.UseStaticFiles();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,24 +34,19 @@ namespace ASC.Web.Api
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddHttpContextAccessor();
|
||||
|
||||
services.AddControllers()
|
||||
.AddNewtonsoftJson()
|
||||
.AddXmlSerializerFormatters();
|
||||
|
||||
services.AddTransient<IConfigureOptions<MvcNewtonsoftJsonOptions>, CustomJsonOptionsWrapper>();
|
||||
|
||||
services.AddMemoryCache();
|
||||
|
||||
services.AddDistributedMemoryCache();
|
||||
services.AddSession();
|
||||
|
||||
services.AddHttpContextAccessor();
|
||||
|
||||
services.AddAuthentication("cookie")
|
||||
.AddScheme<AuthenticationSchemeOptions, CookieAuthHandler>("cookie", a => { })
|
||||
.AddScheme<AuthenticationSchemeOptions, ConfirmAuthHandler>("confirm", a => { });
|
||||
|
||||
var builder = services.AddMvc(config =>
|
||||
var builder = services.AddMvcCore(config =>
|
||||
{
|
||||
var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build();
|
||||
config.Filters.Add(new AuthorizeFilter(policy));
|
||||
@ -108,8 +103,6 @@ namespace ASC.Web.Api
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseSession();
|
||||
|
||||
app.UseAuthentication();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
@ -28,12 +28,15 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Security;
|
||||
using System.Web;
|
||||
|
||||
using ASC.Core;
|
||||
using ASC.Core.Tenants;
|
||||
using ASC.Core.Users;
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
using SecurityContext = ASC.Core.SecurityContext;
|
||||
|
||||
namespace ASC.Web.Core
|
||||
@ -240,7 +243,6 @@ namespace ASC.Web.Core
|
||||
services.TryAddScoped<CookiesManager>();
|
||||
|
||||
return services
|
||||
.AddHttpContextAccessor()
|
||||
.AddUserManagerService()
|
||||
.AddSecurityContextService()
|
||||
.AddTenantCookieSettingsService()
|
||||
|
@ -556,7 +556,6 @@ namespace ASC.Web.Studio.Utility
|
||||
services.TryAddScoped<CommonLinkUtility>();
|
||||
|
||||
return services
|
||||
.AddHttpContextAccessor()
|
||||
.AddUserManagerService()
|
||||
.AddBaseCommonLinkUtilityService()
|
||||
.AddWebItemManagerSecurity()
|
||||
|
@ -126,7 +126,6 @@ namespace ASC.Web.Core.Utility.Skins
|
||||
|
||||
return services
|
||||
.AddWebPathService()
|
||||
.AddHttpContextAccessor()
|
||||
.AddWebItemManager();
|
||||
}
|
||||
}
|
||||
|
@ -28,16 +28,10 @@ namespace ASC.Web.Studio
|
||||
}
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddCors();
|
||||
|
||||
services.AddMvc();
|
||||
services.AddMemoryCache();
|
||||
services.AddDistributedMemoryCache();
|
||||
services.AddSession();
|
||||
{
|
||||
services.AddHttpContextAccessor();
|
||||
|
||||
/*services.AddMvc(options => options.EnableEndpointRouting = false)
|
||||
.AddNewtonsoftJson();*/
|
||||
services.AddCors();
|
||||
|
||||
services.AddAuthentication("cookie").AddScheme<AuthenticationSchemeOptions, CookieAuthHandler>("cookie", a => { });
|
||||
|
||||
@ -75,9 +69,7 @@ namespace ASC.Web.Studio
|
||||
.AllowAnyOrigin()
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod());
|
||||
|
||||
app.UseStaticFiles();
|
||||
app.UseSession();
|
||||
|
||||
app.UseAuthentication();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
|
Loading…
Reference in New Issue
Block a user