GWT- Web 应用程序的历史管理
GWT- History Management for web application
我正在为我的应用程序进行历史管理。我有两个视图,一个是登录,另一个是主应用程序。我添加了本地 links #login 和 #application。现在理想情况下应该发生的是,当用户打开应用程序时,他应该看到具有#login 令牌的登录视图。它工作正常。然后,当他的凭据得到验证时,他会使用令牌#application 进入应用程序视图。当他注销时,他会返回#login。这一切都很好。但令我困扰的是,当我手动将 link 令牌从 #login 更改为 #application 时,即使在我注销后,主应用程序也会直接打开。但是当我在新标签中尝试同样的事情时,它工作正常。
该应用程序容易受到需要修复的攻击。
我需要一些帮助。
//When application loads
History.newItem("application",true);
//When login screen loads //
History.newItem("login",true);
//On change
History.addValueChangeHandler(new ValueChangeHandler<String>(){
@Override
public void onValueChange(ValueChangeEvent<String> event) {
String historyToken = event.getValue();
if (historyToken.substring(0, 5).equals("login")) {
login();
}
if (historyToken.substring(0, 11).equals("application")) {
mainApplicationView();
}
});
当我注销时,将调用 login() 方法,它将相关面板加载到 RootPanel 中,并且内部还有#login 令牌。此外,主应用程序面板已从 rootpanel 中删除。
错误在秒内 if 条件:
History.addValueChangeHandler(new ValueChangeHandler<String>(){
@Override
public void onValueChange(ValueChangeEvent<String> event) {
String historyToken = event.getValue();
if (historyToken.substring(0, 5).equals("login")) {
login();
}
if (historyToken.substring(0, 11).equals("application")) {
startApplication(); //it will again check if the session is valid. If not, login screen will show up. Else mainApplication.
}
});
我注销后,应该无论如何都看不到申请页面了。所以,我应该确保 sessionID 有效。我只在应用程序启动时做了一次,但在 History.addChangeHandler 下没有。这是一个错误。
String sessionID = Cookies.getCookie("JSESSIONID");
if(sessionID == null) {
login();
} else {
checkWithServer();
}
我正在为我的应用程序进行历史管理。我有两个视图,一个是登录,另一个是主应用程序。我添加了本地 links #login 和 #application。现在理想情况下应该发生的是,当用户打开应用程序时,他应该看到具有#login 令牌的登录视图。它工作正常。然后,当他的凭据得到验证时,他会使用令牌#application 进入应用程序视图。当他注销时,他会返回#login。这一切都很好。但令我困扰的是,当我手动将 link 令牌从 #login 更改为 #application 时,即使在我注销后,主应用程序也会直接打开。但是当我在新标签中尝试同样的事情时,它工作正常。 该应用程序容易受到需要修复的攻击。 我需要一些帮助。
//When application loads
History.newItem("application",true);
//When login screen loads //
History.newItem("login",true);
//On change
History.addValueChangeHandler(new ValueChangeHandler<String>(){
@Override
public void onValueChange(ValueChangeEvent<String> event) {
String historyToken = event.getValue();
if (historyToken.substring(0, 5).equals("login")) {
login();
}
if (historyToken.substring(0, 11).equals("application")) {
mainApplicationView();
}
});
当我注销时,将调用 login() 方法,它将相关面板加载到 RootPanel 中,并且内部还有#login 令牌。此外,主应用程序面板已从 rootpanel 中删除。
错误在秒内 if 条件:
History.addValueChangeHandler(new ValueChangeHandler<String>(){
@Override
public void onValueChange(ValueChangeEvent<String> event) {
String historyToken = event.getValue();
if (historyToken.substring(0, 5).equals("login")) {
login();
}
if (historyToken.substring(0, 11).equals("application")) {
startApplication(); //it will again check if the session is valid. If not, login screen will show up. Else mainApplication.
}
});
我注销后,应该无论如何都看不到申请页面了。所以,我应该确保 sessionID 有效。我只在应用程序启动时做了一次,但在 History.addChangeHandler 下没有。这是一个错误。
String sessionID = Cookies.getCookie("JSESSIONID");
if(sessionID == null) {
login();
} else {
checkWithServer();
}