【问题标题】:Unable to sign out from wicket无法从检票口退出
【发布时间】:2016-08-18 23:02:11
【问题描述】:

我正在通过扩展 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 中删除会话时,无法弄清楚为什么它仍然显示身份验证内容。

【问题讨论】:

    标签: wicket


    【解决方案1】:

    请致电session.invalidate() 而不是session.signOut()

    我建议从 Wicket 8.x 的 API 中删除/隐藏 signOut()。最近有人遇到了同样的问题 (What method to use for logout in wicket application?)。

    【讨论】:

    • 我打电话给AuthWebSession.get().invalidate();时也会发生同样的情况
    • 抱歉,signOut 中仍有残留,无效工作正常。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-17
    • 2017-04-04
    • 2019-06-22
    • 2011-03-06
    • 1970-01-01
    • 2023-03-28
    相关资源
    最近更新 更多