如何将 Identity Server v3 配置为仅登录一次并持续 30 天?

How configure Identity Server v3 for login only once persist for 30 days?

我想创建一个应用程序,其中要求用户每 30 天只能登录一次。

应用场景是单页应用,会写在angularjs随着网络的接入api。

如何将身份服务器 v3 配置为仅登录一次?

如果我想保持登录 30 天,此场景的访问令牌的建议生命周期是多少?

您可以将 IdentityServer 配置为发出 30 天持久性 cookie。 https://identityserver.github.io/Documentation/docsv2/configuration/authenticationOptions.html

此外,您可以控制 IdentityServer 是否通过 IAuthenticationSessionValidator 接受来自用户的传入 cookie。基本方法是查看用户登录的时间,如果超过 30 天则不允许使用 cookie。 https://identityserver.github.io/Documentation/docsv2/advanced/session-invalidation.html