增加到期时间(cookie)
我们使用以下方法进行身份验证,我正在尝试弄清楚如何在用户进入特定终点时,如何增加httpcontextaccessor.httpcontext中的到期值?
var authProperties = new AuthenticationProperties
{
AllowRefresh = true,
ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(2),
IsPersistent = true,
IssuedUtc = DateTimeOffset.UtcNow,
RedirectUri = "sign-in"
};
await httpContextAccessor.HttpContext.SignInAsync(
CookieAuthenticationDefaults.AuthenticationScheme,
new ClaimsPrincipal(claimsIdentity),
authProperties);
we authenticate using the below approach, I am trying to figure out how I can increase the Expiry value in HttpContextAccessor.HttpContext when the user goes to a specific end point?
var authProperties = new AuthenticationProperties
{
AllowRefresh = true,
ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(2),
IsPersistent = true,
IssuedUtc = DateTimeOffset.UtcNow,
RedirectUri = "sign-in"
};
await httpContextAccessor.HttpContext.SignInAsync(
CookieAuthenticationDefaults.AuthenticationScheme,
new ClaimsPrincipal(claimsIdentity),
authProperties);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终仅通过更新的
expuiresutc
再次调用httpcontextaccessor.httpcontext.signinasync
。它正常工作。I ended up just calling
httpContextAccessor.HttpContext.SignInAsync
again with an updatedExpuiresUtc
. It worked as expected.