2013-07-02 56 views
2

我使用Spring Security持久登录。我坚持记住我的记号在我的数据库中。有时候,我得到以下错误:如何解决“无效的记忆我记号(系列/记号)不匹配”错误?

| Error 2013-07-02 13:54:14,859 [http-nio-8080-exec-2] ERROR [/buddyis].[gsp] - 
Servlet.service() for servlet [gsp] in context with path [/buddyis] threw exception 
Message: Invalid remember-me token (Series/token) mismatch. Implies previous cookie theft attack. 
Line | Method 
->> 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 615 | run  in java.util.concurrent.ThreadPoolExecutor$Worker 
^ 722 | run . . . in java.lang.Thread 

在我的Config.groovy:

grails.plugins.springsecurity.logout.handlerNames = [ 
'rememberMeServices', 'securityContextLogoutHandler', 'mySecurityEventListener' 
] 
grails.plugins.springsecurity.rememberMe.cookieName = 'RememberMe' 
grails.plugins.springsecurity.rememberMe.alwaysRemember = true 
grails.plugins.springsecurity.rememberMe.tokenValiditySeconds = 31536000 // 365 days 
grails.plugins.springsecurity.rememberMe.key = 'rememberMe' 
grails.plugins.springsecurity.rememberMe.persistent = true 
grails.plugins.springsecurity.rememberMe.persistentToken.domainClassName = 'mypackage.PersistentLogin' 

如何解决这个问题?这是什么意思?

+0

你现在为'rememberMe'配置了哪些配置? – dmahapatro

+0

@dmahapatro我更新了我的配置。 – confile

+0

我认为你是这个[bug](http://jira.grails.org/browse/GPSPRINGSECURITYCORE-70)的受害者,但尚未解决。我最终会猜测Toby Hobson提出的一项工作。 – dmahapatro

回答

1

我在我的移动网站上有同样的例外情况。 当记住我的用户的http会话过期并且用户再次访问网站时,如果有多个并行(ajax)请求发生此问题。

发生这种情况的原因是第一个并行请求将刷新记住我的令牌,并且令牌(无效)的所有其他请求都会与持久令牌不匹配。

所以你没有很多选择来解决这个问题,一个选项是没有并行请求,但在toady的移动应用程序中,这是不太可能的。

我所做的就是要求/我请求启动/加载Web应用程序时首先要做的事情之后,我可以执行多个并行请求,而不必担心会触发此问题。

相关问题