Есть ли способ продлить время ожидания проверки подлинности cookie как часть определенного веб-запроса? У меня есть приложение Angular поверх моего проекта MVC 5, и мне нужно, чтобы он поддерживал сеанс сервера между запросами. У меня угловая часть работает, но кажется, что для URL-адреса на моем сервере недостаточно для сброса тайм-аута Auth. Я новичок в Identity, поэтому, вероятно, я пропустил что-то простое?Как продлить время ожидания приложения ApplicationCookie в Identity 2.0
Мой Startup.Auth.cs
код:
public void ConfigureAuth(IAppBuilder app)
{
// Configure the db context, user manager and signin manager to use a single instance per request
app.CreatePerOwinContext(ApplicationDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
ExpireTimeSpan = TimeSpan.FromSeconds(30),
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
// Enables the application to validate the security stamp when the user logs in.
// This is a security feature which is used when you change a password or add an external login to your account.
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(20),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
}
И мой простой метод (разрешение устанавливается глобально для всех запросов, которые не имеют [AllowAnonymous]
):
[HttpGet]
public HttpResponseMessage KeepAuthAlive()
{
// Renew Auth Cookie - how?
}