我正在使用彈簧安全功能2.計數活動用戶
1.可能我知道如何使用securitycontextholder獲取活動用戶的總數?
2.可以從securitycontextholder檢索sessionregistry?
我正在使用彈簧安全功能2.計數活動用戶
1.可能我知道如何使用securitycontextholder獲取活動用戶的總數?
2.可以從securitycontextholder檢索sessionregistry?
我不知道如何與春天做。但是在servlet中,您需要爲偵聽器類實現HttpSession偵聽器接口。該接口有兩個方法,分別是sessionCreated()和sessionDestroyed()。無論何時創建新會話,都可以在sessionCreated方法中增加靜態變量。
延長AuthenticationProcessingFilter
覆蓋
@Override
protected void onSuccessfulAuthentication(HttpServletRequest request,
HttpServletResponse response, Authentication authResult)
throws IOException {
,在這裏你可以保持應用程序變量做你想要做的事情。
sessionCreated如果將命中用戶登錄頁面被調用。我認爲他需要活躍用戶,登錄用戶。 – 2010-09-29 06:57:58
@ org.life.java您在登錄頁面上創建會話或用戶身份驗證成功後 – 2010-09-29 06:59:57
就Spring Security而言,這是跟蹤登錄事件的恰當場所。 – 2010-09-29 07:01:43