0
私はユーザーのサインインを維持するために、owin cookie認証を使用していますが、クッキーが期限切れになることなくクライアントブラウザから消えていることに気付きました。有効期限が切れる前にsigninのクッキーが消える
var identity = new ClaimsIdentity(DefaultAuthenticationTypes.ApplicationCookie);
var properties = new AuthenticationProperties() {
IssuedUtc = DateTime.UtcNow,
ExpiresUtc = DateTime.UtcNow.Add(Startup.CookieAuthenticationOptions.ExpireTimeSpan),
IsPersistent = true
};
HttpContext.Current.GetOwinContext().Authentication.SignIn(properties, identity);
スタートアップ:
public class Startup {
public void Configuration(IAppBuilder app) {
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture;
GlobalHost.Configuration.DefaultMessageBufferSize = 100;
ConfigureCookie(app);
app.MapSignalR();
}
public static CookieAuthenticationOptions CookieAuthenticationOptions { get; private set; }
public void ConfigureCookie(IAppBuilder app) {
CookieAuthenticationOptions = new CookieAuthenticationOptions() {
ExpireTimeSpan = TimeSpan.FromDays(7),
CookieSecure = CookieSecureOption.SameAsRequest,
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
CookieName = "TokenHandler"
};
app.UseCookieAuthentication(CookieAuthenticationOptions);
}
}
誰もが任意の手掛かりを持っていますか?私はこれを確信しているわけではありませんが、もっとサインインする必要があるので、私が得た気持ちです。このウェブサイトの新しいリリースがこれを引き起こす可能性はありますか?