无法从检票口注销
Unable to sign out from wicket
我正在通过扩展 AuthenticatedWebSession 来管理身份验证
正在登录
@Override
protected boolean authenticate(String username, String password) {
return true/false some auth logic here;
}
退出
@Override
public void signOut() {
super.signOut();
this.getApplication().getSecuritySettings().getAuthenticationStrategy().remove();
this.getSessionStore().invalidate(RequestCycle.get().getRequest());
throw new RedirectToUrlException("some_url_that_does_not_require_auth", HttpServletResponse.SC_MOVED_TEMPORARILY);
}
还有我的页面配置
@AuthorizeInstantiation("ADMIN")
public class Home extends Base {
//Page stuff here
}
现在的问题是,如果我注销,我仍然可以访问经过身份验证的内容。通过单击后退按钮或将 url 粘贴到浏览器。我只能看内容,当我点击某些内容时它会将我重定向到非授权页面。
当注销会话 ID 更改并且会话从 SecuritySettings 中删除时,无法弄清楚为什么它仍然显示授权内容。
调用 session.invalidate()
而不是 session.signOut()
。
我会建议 remove/hide signOut()
来自 API 的 Wicket 8.x。最近有人遇到了同样的问题(What method to use for logout in wicket application?)。
我正在通过扩展 AuthenticatedWebSession 来管理身份验证
正在登录
@Override
protected boolean authenticate(String username, String password) {
return true/false some auth logic here;
}
退出
@Override
public void signOut() {
super.signOut();
this.getApplication().getSecuritySettings().getAuthenticationStrategy().remove();
this.getSessionStore().invalidate(RequestCycle.get().getRequest());
throw new RedirectToUrlException("some_url_that_does_not_require_auth", HttpServletResponse.SC_MOVED_TEMPORARILY);
}
还有我的页面配置
@AuthorizeInstantiation("ADMIN")
public class Home extends Base {
//Page stuff here
}
现在的问题是,如果我注销,我仍然可以访问经过身份验证的内容。通过单击后退按钮或将 url 粘贴到浏览器。我只能看内容,当我点击某些内容时它会将我重定向到非授权页面。
当注销会话 ID 更改并且会话从 SecuritySettings 中删除时,无法弄清楚为什么它仍然显示授权内容。
调用 session.invalidate()
而不是 session.signOut()
。
我会建议 remove/hide signOut()
来自 API 的 Wicket 8.x。最近有人遇到了同样的问题(What method to use for logout in wicket application?)。