Skip to content

Commit c5be3f3

Browse files
authored
Update Startup.cs
1 parent 448c958 commit c5be3f3

File tree

1 file changed

+8
-2
lines changed
  • src/AbpCompanyName.AbpProjectName.WebMpa/App_Start

1 file changed

+8
-2
lines changed

src/AbpCompanyName.AbpProjectName.WebMpa/App_Start/Startup.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System;
2+
using System.Configuration;
13
using Abp.Owin;
24
using AbpCompanyName.AbpProjectName.Api.Controllers;
35
using AbpCompanyName.AbpProjectName.WebMpa;
@@ -21,7 +23,11 @@ public void Configuration(IAppBuilder app)
2123
app.UseCookieAuthentication(new CookieAuthenticationOptions
2224
{
2325
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
24-
LoginPath = new PathString("/Account/Login")
26+
LoginPath = new PathString("/Account/Login"),
27+
// 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
28+
ExpireTimeSpan = new TimeSpan(int.Parse(ConfigurationManager.AppSettings["AuthSession.ExpireTimeInDays.WhenPersistet"] ?? "14"), 0, 0, 0),
29+
SlidingExpiration = bool.Parse(ConfigurationManager.AppSettings["AuthSession.SlidingExpirationEnabled"] ?? bool.FalseString)
30+
2531
});
2632

2733
app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
@@ -35,4 +41,4 @@ public void Configuration(IAppBuilder app)
3541
//});
3642
}
3743
}
38-
}
44+
}

0 commit comments

Comments
 (0)