简体   繁体   English

Java-管理令牌-Struts-多次会话

[英]Java - Manage Token - Struts - severals sessions

I use tokens with Struts thanks to the class TokenProcessor.java. 由于类TokenProcessor.java,我在Struts中使用了令牌。 However, if a user opens a new tab, there is a conflict with the tokens because the tokens they are linked with sessions and not the class. 但是,如果用户打开一个新选项卡,则与令牌有冲突,因为它们与会话而不是与类链接在一起。

I try to use this : http://www.coderanch.com/t/312306/EJB-JEE/java/Synchronizer-Token-EE-pattern-book but it doesn't seem to work. 我尝试使用此方法: http : //www.coderanch.com/t/312306/EJB-JEE/java/Synchronizer-Token-EE-pattern-book,但它似乎不起作用。

Thanks in advance for you help. 在此先感谢您的帮助。

TokenProcessor generates and stores a token in a session attribute called "org.apache.struts.action.TOKEN" (from the constant Globals.TRANSACTION_TOKEN_KEY). TokenProcessor生成令牌并将其存储在称为“ org.apache.struts.action.TOKEN”的会话属性中(来自常量Globals.TRANSACTION_TOKEN_KEY)。 This means that, as you are finding, it is not going to work if a user has multiple pages open for the same session eg if they open multiple tabs. 正如您所发现的,这意味着,如果用户为同一会话打开了多个页面,例如,如果他们打开了多个选项卡,它将无法正常工作。 If you need to be able to support this use case then I think you'll have to implement token checking differently. 如果您需要能够支持该用例,那么我认为您将必须以不同的方式实现令牌检查。

Looks like someone submitted a patch to get round this problem (note that I haven't looked at what this does): https://issues.apache.org/jira/browse/STR-1609 看起来有人提交了补丁来解决此问题(请注意,我尚未查看此操作): https : //issues.apache.org/jira/browse/STR-1609

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM