2022-03-15 18:00:53 +00:00
|
|
|
// (c) Copyright Ascensio System SIA 2010-2022
|
|
|
|
//
|
|
|
|
// This program is a free software product.
|
|
|
|
// You can redistribute it and/or modify it under the terms
|
|
|
|
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
|
|
|
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
|
|
|
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
|
|
|
// any third-party rights.
|
|
|
|
//
|
|
|
|
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
|
|
|
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
|
|
|
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
|
|
|
//
|
|
|
|
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
|
|
|
//
|
|
|
|
// The interactive user interfaces in modified source and object code versions of the Program must
|
|
|
|
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
|
|
|
//
|
|
|
|
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
|
|
|
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
|
|
|
// trademark law for use of our trademarks.
|
|
|
|
//
|
|
|
|
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
|
|
|
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
|
|
|
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
2020-10-28 12:26:27 +00:00
|
|
|
|
2022-02-11 10:23:56 +00:00
|
|
|
namespace ASC.Web.Studio;
|
|
|
|
public class Startup : BaseStartup
|
2019-05-15 14:56:09 +00:00
|
|
|
{
|
2022-02-11 10:23:56 +00:00
|
|
|
public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment) : base(configuration, hostEnvironment)
|
2021-07-13 18:17:18 +00:00
|
|
|
{
|
2022-02-11 10:23:56 +00:00
|
|
|
}
|
2019-05-15 14:56:09 +00:00
|
|
|
|
2022-02-11 10:23:56 +00:00
|
|
|
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
2022-02-03 13:53:42 +00:00
|
|
|
{
|
|
|
|
base.Configure(app, env);
|
2021-06-22 16:55:47 +00:00
|
|
|
|
2022-02-03 13:53:42 +00:00
|
|
|
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
2020-07-15 12:33:44 +00:00
|
|
|
{
|
2022-02-03 13:53:42 +00:00
|
|
|
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
|
|
|
});
|
2020-07-15 12:33:44 +00:00
|
|
|
|
2022-02-03 13:53:42 +00:00
|
|
|
app.UseRouting();
|
2020-10-18 16:34:30 +00:00
|
|
|
|
2022-02-11 10:23:56 +00:00
|
|
|
app.UseCors(builder =>
|
|
|
|
builder
|
|
|
|
.AllowAnyOrigin()
|
|
|
|
.AllowAnyHeader()
|
|
|
|
.AllowAnyMethod());
|
2019-05-15 14:56:09 +00:00
|
|
|
|
2022-02-03 13:53:42 +00:00
|
|
|
app.UseAuthentication();
|
2021-06-22 16:55:47 +00:00
|
|
|
|
2022-02-03 13:53:42 +00:00
|
|
|
app.UseEndpoints(endpoints =>
|
|
|
|
{
|
|
|
|
endpoints.InitializeHttpHandlers();
|
|
|
|
});
|
2020-02-20 14:57:48 +00:00
|
|
|
|
2022-04-28 12:45:11 +00:00
|
|
|
app.MapWhen(
|
|
|
|
context => context.Request.Path.ToString().EndsWith("ssologin.ashx"),
|
|
|
|
appBranch =>
|
|
|
|
{
|
|
|
|
appBranch.UseSsoHandler();
|
|
|
|
});
|
2019-06-04 14:43:20 +00:00
|
|
|
|
2022-02-03 13:53:42 +00:00
|
|
|
app.MapWhen(
|
|
|
|
context => context.Request.Path.ToString().EndsWith("login.ashx"),
|
|
|
|
appBranch =>
|
2019-06-04 14:43:20 +00:00
|
|
|
{
|
2022-02-03 13:53:42 +00:00
|
|
|
appBranch.UseLoginHandler();
|
2020-07-28 08:13:49 +00:00
|
|
|
});
|
2022-02-11 10:23:56 +00:00
|
|
|
}
|
2020-07-28 08:13:49 +00:00
|
|
|
|
2022-02-11 15:05:40 +00:00
|
|
|
public override void ConfigureServices(IServiceCollection services)
|
|
|
|
{
|
|
|
|
services.AddCors();
|
2022-04-28 12:45:11 +00:00
|
|
|
|
2022-02-11 15:05:40 +00:00
|
|
|
base.ConfigureServices(services);
|
2022-04-25 18:41:26 +00:00
|
|
|
|
2022-02-11 15:05:40 +00:00
|
|
|
services.AddMemoryCache();
|
|
|
|
DIHelper.TryAdd<Login>();
|
|
|
|
DIHelper.TryAdd<PathUtils>();
|
2022-03-25 09:23:28 +00:00
|
|
|
DIHelper.TryAdd<StorageFactory>();
|
2022-02-11 15:05:40 +00:00
|
|
|
DIHelper.TryAdd<GoogleLoginProvider>();
|
|
|
|
DIHelper.TryAdd<FacebookLoginProvider>();
|
|
|
|
DIHelper.TryAdd<LinkedInLoginProvider>();
|
2022-05-13 08:52:49 +00:00
|
|
|
DIHelper.TryAdd<SsoHandlerService>();
|
2019-05-15 14:56:09 +00:00
|
|
|
}
|
|
|
|
}
|