DocSpace-buildtools/web/ASC.Web.Studio/Startup.cs

55 lines
1.5 KiB
C#
Raw Normal View History

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
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
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();
});
2022-02-03 13:53:42 +00:00
app.MapWhen(
context => context.Request.Path.ToString().EndsWith("login.ashx"),
appBranch =>
{
appBranch.UseLoginHandler();
});
}
2022-02-11 15:05:40 +00:00
public override void ConfigureServices(IServiceCollection services)
{
services.AddCors();
base.ConfigureServices(services);
services.AddMemoryCache();
DIHelper.TryAdd<Login>();
DIHelper.TryAdd<PathUtils>();
DIHelper.TryAdd<StorageHandlerScope>();
DIHelper.TryAdd<GoogleLoginProvider>();
DIHelper.TryAdd<FacebookLoginProvider>();
DIHelper.TryAdd<LinkedInLoginProvider>();
}
}