gpt4 book ai didi

mongodb - Spring remember-me with MongoDB 不会删除 token

转载 作者:可可西里 更新时间:2023-11-01 10:02:47 26 4
gpt4 key购买 nike

我关注了this使用 MongoDB 实现记住我功能的教程。

当我在登录页面中单击 rememberme 复选框时, token 将保存在数据库中。如果我手动删除数据库条目并且 cookie JSESSIONID maxage 已过期,我将被注销,如果 JSESSIONID 已过期而 remember-me cookie 没有,我仍然登录,这很好。

一切正常,但我有一个问题。永远不会调用 removeUserTokens 函数,我应该从数据库中手动删除 token 条目吗?如果是,我应该在哪里实现?

谢谢。

最佳答案

必须根据 Java doc 手动删除(例如通过批处理) .

PersistentTokenBasedRememberMeServices

Note that while this class will use the date a token was created to check whether a presented cookie is older than the configured tokenValiditySeconds property and deny authentication in this case, it will not delete these tokens from storage. A suitable batch process should be run periodically to remove expired tokens from the database.

PersistentTokenBasedRememberMeServices 使用的抽象 (PersistentTokenRepository) 为用户存储持久登录 token 。

关于mongodb - Spring remember-me with MongoDB 不会删除 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40468800/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com