Skip to content

Commit

Permalink
Merge branch 'develop' into feature/reworked-user-service
Browse files Browse the repository at this point in the history
  • Loading branch information
MaksimChegulov committed Dec 13, 2021
2 parents 6ccda4d + 8d1f9da commit b42fd9c
Show file tree
Hide file tree
Showing 241 changed files with 1,966 additions and 2,323 deletions.
Binary file not shown.
Binary file not shown.
Binary file removed .nuget/packages/Microsoft.Graph.Core.1.5.0.2.nupkg
Binary file not shown.
Binary file added .nuget/packages/Microsoft.Graph.Core.1.6.0.nupkg
Binary file not shown.
Binary file removed .nuget/packages/Microsoft.OneDriveSDK.2.0.7.6.nupkg
Binary file not shown.
Binary file not shown.
Binary file removed .nuget/packages/Openstack.net.1.7.9.nupkg
Binary file not shown.
Binary file added .nuget/packages/Openstack.net.1.8.0.nupkg
Binary file not shown.
Binary file removed .nuget/packages/Rackspace.0.2.1.nupkg
Binary file not shown.
Binary file added .nuget/packages/Rackspace.1.0.0.nupkg
Binary file not shown.
Binary file not shown.
Binary file not shown.
34 changes: 26 additions & 8 deletions ASC.Tests.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30413.136
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files.Tests", "products\ASC.Files\Tests\ASC.Files.Tests.csproj", "{EFB99A37-EF25-4A0F-8D7A-786402B1554C}"
EndProject
Expand Down Expand Up @@ -73,7 +73,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Webhooks.Tests", "commo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Webhooks.Service", "common\services\ASC.Webhooks.Service\ASC.Webhooks.Service.csproj", "{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASC.Web.Api.Tests", "common\Tests\ASC.Web.Api.Tests\ASC.Web.Api.Tests.csproj", "{14823E93-C749-4069-9E0A-95E63DE0B254}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Web.Api.Tests", "common\Tests\ASC.Web.Api.Tests\ASC.Web.Api.Tests.csproj", "{14823E93-C749-4069-9E0A-95E63DE0B254}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Backup.Core", "common\ASC.Data.Backup.Core\ASC.Data.Backup.Core.csproj", "{5E948877-52BD-42B9-95A9-0FF37931D0A5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Encryption", "common\ASC.Data.Encryption\ASC.Data.Encryption.csproj", "{9E572FE2-8C3C-46B2-A314-532F7198B3EB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.AuditTrail", "common\services\ASC.AuditTrail\ASC.AuditTrail.csproj", "{B53587B7-58F6-48A9-B122-69BEA3E2572A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -209,10 +215,6 @@ Global
{8FAD3D1B-3ADC-470C-9933-CAE1B95A8599}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8FAD3D1B-3ADC-470C-9933-CAE1B95A8599}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8FAD3D1B-3ADC-470C-9933-CAE1B95A8599}.Release|Any CPU.Build.0 = Release|Any CPU
{14823E93-C749-4069-9E0A-95E63DE0B254}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{14823E93-C749-4069-9E0A-95E63DE0B254}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14823E93-C749-4069-9E0A-95E63DE0B254}.Release|Any CPU.ActiveCfg = Release|Any CPU
{14823E93-C749-4069-9E0A-95E63DE0B254}.Release|Any CPU.Build.0 = Release|Any CPU
{A0475D4F-29B7-490C-85C2-8AFD60118B35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0475D4F-29B7-490C-85C2-8AFD60118B35}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0475D4F-29B7-490C-85C2-8AFD60118B35}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -224,7 +226,23 @@ Global
{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection
{14823E93-C749-4069-9E0A-95E63DE0B254}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{14823E93-C749-4069-9E0A-95E63DE0B254}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14823E93-C749-4069-9E0A-95E63DE0B254}.Release|Any CPU.ActiveCfg = Release|Any CPU
{14823E93-C749-4069-9E0A-95E63DE0B254}.Release|Any CPU.Build.0 = Release|Any CPU
{5E948877-52BD-42B9-95A9-0FF37931D0A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E948877-52BD-42B9-95A9-0FF37931D0A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E948877-52BD-42B9-95A9-0FF37931D0A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E948877-52BD-42B9-95A9-0FF37931D0A5}.Release|Any CPU.Build.0 = Release|Any CPU
{9E572FE2-8C3C-46B2-A314-532F7198B3EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9E572FE2-8C3C-46B2-A314-532F7198B3EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9E572FE2-8C3C-46B2-A314-532F7198B3EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9E572FE2-8C3C-46B2-A314-532F7198B3EB}.Release|Any CPU.Build.0 = Release|Any CPU
{B53587B7-58F6-48A9-B122-69BEA3E2572A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B53587B7-58F6-48A9-B122-69BEA3E2572A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B53587B7-58F6-48A9-B122-69BEA3E2572A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B53587B7-58F6-48A9-B122-69BEA3E2572A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
Expand Down
1 change: 1 addition & 0 deletions build/install/docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ELK_VERSION=7.13.1
SERVICE_PORT=5050
CONTAINER_PREFIX=${PRODUCT}-
DOCUMENT_SERVER_IMAGE_NAME=onlyoffice/4testing-documentserver-ee:latest
DOCKER_TAG=latest
DOCKERFILE=Dockerfile.app

Expand Down
2 changes: 1 addition & 1 deletion build/install/docker/ds.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3.6'
services:
onlyoffice-document-server:
image: "${REPO}/${STATUS}documentserver:latest"
image: "${DOCUMENT_SERVER_IMAGE_NAME}"
container_name: ${DOCUMENT_SERVER_HOST}
# Strings below enable the JSON Web Token validation.
environment:
Expand Down
4 changes: 2 additions & 2 deletions common/ASC.Api.Core/ASC.Api.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>

Expand All @@ -17,7 +17,7 @@
<PackageReference Include="AspNetCore.HealthChecks.NpgSql" Version="5.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="NLog" Version="4.7.10" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />
</ItemGroup>

Expand Down
62 changes: 31 additions & 31 deletions common/ASC.Api.Core/Core/BaseStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

using Microsoft.Extensions.Hosting;

using NLog;
using NLog.Extensions.Logging;

namespace ASC.Api.Core
{
public abstract class BaseStartup
{
{
public abstract class BaseStartup
{
public IConfiguration Configuration { get; }
public IHostEnvironment HostEnvironment { get; }
public virtual JsonConverter[] Converters { get; }
Expand All @@ -52,14 +52,14 @@ public BaseStartup(IConfiguration configuration, IHostEnvironment hostEnvironmen
{
Configuration = configuration;
HostEnvironment = hostEnvironment;
DIHelper = new DIHelper();
DIHelper = new DIHelper();
if (bool.TryParse(Configuration["core:products"], out var loadProducts))
{
LoadProducts = loadProducts;
}
}
}

public virtual void ConfigureServices(IServiceCollection services)
public virtual void ConfigureServices(IServiceCollection services)
{
services.AddCustomHealthCheck(Configuration);
services.AddHttpContextAccessor();
Expand All @@ -69,20 +69,20 @@ public virtual void ConfigureServices(IServiceCollection services)
services.AddSession();

DIHelper.Configure(services);


Action<JsonOptions> jsonOptions = options =>
{
options.JsonSerializerOptions.WriteIndented = false;
options.JsonSerializerOptions.IgnoreNullValues = true;
options.JsonSerializerOptions.Converters.Add(new ApiDateTimeConverter());

if (Converters != null)
{
foreach (var c in Converters)
{
options.JsonSerializerOptions.Converters.Add(c);
}
}
{
options.JsonSerializerOptions.WriteIndented = false;
options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
options.JsonSerializerOptions.Converters.Add(new ApiDateTimeConverter());

if (Converters != null)
{
foreach (var c in Converters)
{
options.JsonSerializerOptions.Converters.Add(c);
}
}
};

services.AddControllers()
Expand Down Expand Up @@ -110,19 +110,19 @@ public virtual void ConfigureServices(IServiceCollection services)
}

var builder = services.AddMvcCore(config =>
{
{
config.Conventions.Add(new ControllerNameAttributeConvention());

var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build();
var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build();

config.Filters.Add(new AuthorizeFilter(policy));
config.Filters.Add(new TypeFilterAttribute(typeof(TenantStatusFilter)));
config.Filters.Add(new TypeFilterAttribute(typeof(PaymentFilter)));
config.Filters.Add(new TypeFilterAttribute(typeof(IpSecurityFilter)));
config.Filters.Add(new TypeFilterAttribute(typeof(ProductSecurityFilter)));
config.Filters.Add(new AuthorizeFilter(policy));
config.Filters.Add(new TypeFilterAttribute(typeof(TenantStatusFilter)));
config.Filters.Add(new TypeFilterAttribute(typeof(PaymentFilter)));
config.Filters.Add(new TypeFilterAttribute(typeof(IpSecurityFilter)));
config.Filters.Add(new TypeFilterAttribute(typeof(ProductSecurityFilter)));
config.Filters.Add(new CustomResponseFilterAttribute());
config.Filters.Add(new CustomExceptionFilterAttribute());
config.Filters.Add(new TypeFilterAttribute(typeof(FormatFilter)));
config.Filters.Add(new TypeFilterAttribute(typeof(FormatFilter)));
config.Filters.Add(new TypeFilterAttribute(typeof(WebhooksGlobalFilterAttribute)));

config.OutputFormatters.RemoveType<XmlSerializerOutputFormatter>();
Expand All @@ -149,7 +149,7 @@ public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment env)
});

app.UseRouting();


if (AddAndUseSession)
app.UseSession();

Expand Down Expand Up @@ -182,7 +182,7 @@ public void ConfigureContainer(ContainerBuilder builder)
{
builder.Register(Configuration, LoadProducts, LoadConsumers);
}
}
}

public static class LogNLogConfigureExtenstion
{
Expand Down
14 changes: 6 additions & 8 deletions common/ASC.Common/ASC.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ProductVersion>9.0.30729</ProductVersion>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<FileUpgradeFlags />
<UpgradeBackupLocation />
<AssemblyTitle>ASC.Common</AssemblyTitle>
Expand Down Expand Up @@ -39,13 +39,12 @@
</PackageReference>
<PackageReference Include="JWT" Version="6.1.4" />
<PackageReference Include="log4net" Version="2.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="5.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0" />
<!-- <PackageReference Include="Microsoft.CodeQuality.Analyzers" Version="2.9.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -56,7 +55,6 @@
</PackageReference> -->
<PackageReference Include="NLog" Version="4.7.10" />
<PackageReference Include="NVelocity" Version="1.2.0" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="protos\AscCacheItem.proto" />
Expand Down
29 changes: 16 additions & 13 deletions common/ASC.Common/Security/Cryptography/InstanceCrypto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,36 +50,39 @@ public string Encrypt(string data)

public byte[] Encrypt(byte[] data)
{
var hasher = Rijndael.Create();
var hasher = Aes.Create();
hasher.Key = EKey();
hasher.IV = new byte[hasher.BlockSize >> 3];

using var ms = new MemoryStream();
using var ss = new CryptoStream(ms, hasher.CreateEncryptor(), CryptoStreamMode.Write);
ss.Write(data, 0, data.Length);
using var plainTextStream = new MemoryStream(data);
plainTextStream.CopyTo(ss);
ss.FlushFinalBlock();
hasher.Clear();
return ms.ToArray();
}

public string Decrypt(string data)
{
return Encoding.UTF8.GetString(Decrypt(Convert.FromBase64String(data)));
return Decrypt(Convert.FromBase64String(data));
}

public byte[] Decrypt(byte[] data)
public string Decrypt(byte[] data)
{
var hasher = Rijndael.Create();
var hasher = Aes.Create();
hasher.Key = EKey();
hasher.IV = new byte[hasher.BlockSize >> 3];

using var ms = new MemoryStream(data);
using var ss = new CryptoStream(ms, hasher.CreateDecryptor(), CryptoStreamMode.Read);
var buffer = new byte[data.Length];
var size = ss.Read(buffer, 0, buffer.Length);
hasher.Clear();
var newBuffer = new byte[size];
Array.Copy(buffer, newBuffer, size);
return newBuffer;
using (MemoryStream msDecrypt = new MemoryStream(data))
using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, hasher.CreateDecryptor(), CryptoStreamMode.Read))
using (StreamReader srDecrypt = new StreamReader(csDecrypt))
{

// Read the decrypted bytes from the decrypting stream
// and place them in a string.
return srDecrypt.ReadToEnd();
}
}

private byte[] EKey()
Expand Down
7 changes: 3 additions & 4 deletions common/ASC.Core.Common/ASC.Core.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<ProductVersion>9.0.30729</ProductVersion>
<ProjectGuid>{A51D0454-4AFA-46DE-89D4-B03D37E1816C}</ProjectGuid>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<FileUpgradeFlags />
<UpgradeBackupLocation />
<AssemblyTitle>ASC.Core.Common</AssemblyTitle>
Expand Down Expand Up @@ -51,14 +51,13 @@
<ItemGroup>
<PackageReference Include="AWSSDK.Core" Version="3.5.1.25" />
<PackageReference Include="AWSSDK.SimpleEmail" Version="3.5.0.27" />
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="Grpc.Tools" Version="2.32.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MailKit" Version="2.5.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0" />
<PackageReference Include="Telegram.Bot" Version="15.7.1" />
</ItemGroup>
<ItemGroup>
Expand Down
Loading

0 comments on commit b42fd9c

Please sign in to comment.