2022-02-11 10:23:56 +00:00
|
|
|
namespace ASC.Web.Studio;
|
|
|
|
public class Startup : BaseStartup
|
|
|
|
{
|
|
|
|
public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment) : base(configuration, hostEnvironment)
|
|
|
|
{
|
|
|
|
}
|
2020-10-28 12:26:27 +00:00
|
|
|
|
2022-02-11 10:23:56 +00:00
|
|
|
public override void ConfigureServices(IServiceCollection services)
|
|
|
|
{
|
2022-02-03 13:53:42 +00:00
|
|
|
services.AddCors();
|
2020-07-15 12:33:44 +00:00
|
|
|
|
2022-02-03 13:53:42 +00:00
|
|
|
base.ConfigureServices(services);
|
2020-10-18 16:34:30 +00:00
|
|
|
|
2022-02-03 13:53:42 +00:00
|
|
|
services.AddMemoryCache();
|
|
|
|
DIHelper.TryAdd<Login>();
|
|
|
|
DIHelper.TryAdd<PathUtils>();
|
|
|
|
DIHelper.TryAdd<StorageHandlerScope>();
|
|
|
|
DIHelper.TryAdd<GoogleLoginProvider>();
|
|
|
|
DIHelper.TryAdd<FacebookLoginProvider>();
|
|
|
|
DIHelper.TryAdd<LinkedInLoginProvider>();
|
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
|
|
|
|
{
|
|
|
|
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
|
|
|
});
|
2020-10-12 16:23:15 +00:00
|
|
|
|
2022-02-03 13:53:42 +00:00
|
|
|
app.UseRouting();
|
2020-10-12 16:23:15 +00:00
|
|
|
|
2022-02-11 10:23:56 +00:00
|
|
|
app.UseCors(builder =>
|
|
|
|
builder
|
|
|
|
.AllowAnyOrigin()
|
|
|
|
.AllowAnyHeader()
|
|
|
|
.AllowAnyMethod());
|
2020-02-20 14:57:48 +00:00
|
|
|
|
2022-02-03 13:53:42 +00:00
|
|
|
app.UseAuthentication();
|
2019-06-04 14:43:20 +00:00
|
|
|
|
2022-02-03 13:53:42 +00:00
|
|
|
app.UseEndpoints(endpoints =>
|
|
|
|
{
|
|
|
|
endpoints.InitializeHttpHandlers();
|
|
|
|
});
|
2020-07-28 08:13:49 +00:00
|
|
|
|
2022-02-03 13:53:42 +00:00
|
|
|
app.MapWhen(
|
|
|
|
context => context.Request.Path.ToString().EndsWith("login.ashx"),
|
|
|
|
appBranch =>
|
|
|
|
{
|
|
|
|
appBranch.UseLoginHandler();
|
2020-07-28 08:13:49 +00:00
|
|
|
});
|
2022-02-11 10:23:56 +00:00
|
|
|
}
|
|
|
|
}
|