2016-08-18 71 views
0

我管理認證通過延長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 
} 

沒有問題是,如果我退出,我仍然可以訪問已驗證的內容。通過點擊返回按鈕或粘貼到瀏覽器的網址。我只能看內容,當我點擊某些東西時,它會將我重定向到非授權頁面。

註銷會話ID更改並從SecuritySettings中刪除會話時,無法弄清楚它爲什麼仍顯示身份驗證內容。

回答

2

致電session.invalidate()而不是session.signOut()

我建議從Wicket 8.x的API中刪除/隱藏signOut()。最近有人遇到同樣的問題(What method to use for logout in wicket application?)。

+1

https://issues.apache.org/jira/browse/WICKET-6228 –

+0

當我調用'AuthWebSession.get()。invalidate();' – user3960875

+0

時發生同樣的情況對不起,我仍然留下signOut留下的殘留,使工作無效好。 – user3960875