Startup.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Configuration;
  3. using Abp.Owin;
  4. using Microsoft.Owin;
  5. using Microsoft.Owin.Security.Cookies;
  6. using Owin;
  7. using ShwasherSys;
  8. using ShwasherSys.Api.Controllers;
  9. [assembly: OwinStartup(typeof(Startup))]
  10. namespace ShwasherSys
  11. {
  12. public class Startup
  13. {
  14. public void Configuration(IAppBuilder app)
  15. {
  16. app.UseAbp();
  17. app.UseOAuthBearerAuthentication(AccountController.OAuthBearerOptions);
  18. app.UseCookieAuthentication(new CookieAuthenticationOptions
  19. {
  20. AuthenticationType = ShwasherConsts.AuthenticationTypes,
  21. LoginPath = new PathString("/Account/Login"),
  22. // by setting following values, the auth cookie will expire after the configured amount of time (default 14 days) when user set the (IsPermanent == true) on the login
  23. ExpireTimeSpan = new TimeSpan(int.Parse(ConfigurationManager.AppSettings["AuthSession.ExpireTimeInDays.WhenPersistent"] ?? "14"), 0, 0, 0),
  24. SlidingExpiration = bool.Parse(ConfigurationManager.AppSettings["AuthSession.SlidingExpirationEnabled"] ?? bool.FalseString)
  25. });
  26. app.MapSignalR();
  27. //app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
  28. //ENABLE TO USE HANGFIRE dashboard (Requires enabling Hangfire in IwbYueWebModule)
  29. //app.UseHangfireDashboard("/hangfire", new DashboardOptions
  30. //{
  31. // Authorization = new[] { new AbpHangfireAuthorizationFilter() } //You can remove this line to disable authorization
  32. //});
  33. }
  34. }
  35. }