asp.net-core - Hook 到 IdentityServer4 session cookie 滑动过期

标签 asp.net-core identityserver4 session-cookies slidingexpiration

当 IdentityServer 对 session cookie (idsrv) 执行过期时间滑动时,我需要运行一些自定义代码(管理另一个自定义 cookie)。

如何或在何处连接到 IdentityServer 管道以完成此操作? 是否有我可以覆盖的内容或是否有我可以订阅的事件?

我目前在 asp.net core 3.1 应用程序中使用 IdentityServer4 3.x。

最佳答案

AddIdentityServer扩展只是添加默认的 cookie 处理程序。并设置 CookieAuthenticationOptions基于传递值的 Prop 。

根据官方描述,滑动过期是这样的:

The SlidingExpiration is set to true to instruct the handler to re-issue a new cookie with a new expiration time any time it processes a request which is more than halfway through the expiration window.

考虑到这些,如果您需要对滑动 session cookie 的到期时间 做某事,您需要有一个自定义的 cookie 处理程序,它以不同的方式做事

关于asp.net-core - Hook 到 IdentityServer4 session cookie 滑动过期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63776309/

相关文章:

c# - 进程内和进程外托管的 ASP .NET Core 3 + Identity Server 问题

webforms - 带有身份服务器 4 的 asp.net Web 表单客户端

c# - 想要将混合流身份验证添加到 SPA 的(dotnet)后端

python - Flask: session 数据已设置但无法检索

asp.net - ASP.NET MVC 中的 session cookie 持久性

c# - OpenIdConnect 重定向到 http 而不是 https

asp.net-core - ASP.NET 5 的 Web 服务器,无需调试即可工作

docker - Dockerize asnet核心webapi

powershell - OIDC token 签名和 token 验证的适当X.509设置

php - 与本地存储的 session