5
我開發了一個使用spring安全性的web應用程序。對於登錄,它從LDAP訪問。現在我想用彈簧安全本身管理會話,我可以通過使用authentication.getName()
來獲得username
,我也可以獲得sessionID
。使用Spring Security的會話管理:併發會話
現在我想確定,如果同一用戶試圖使用其他瀏覽器從同一系統登錄,他應該會收到一條消息,說他已經登錄了他的帳戶。
任何人都可以提供一個想法如何實現這?
<security:session-management
invalid-session-url="/login.jsp?error=sessionExpired"
session-authentication-error-url="/login.jsp?error=alreadyLogin">
<security:concurrency-control
max-sessions="1"
expired-url="/login.jsp?error=sessionExpiredDuplicateLogin"
error-if-maximum-exceeded="false" />
</security:session-management>
當我使用這一點,並嘗試使用一些其他的瀏覽器,它給了我下面的錯誤登錄:
HTTP Status 500 - Request processing failed; nested exception is java.lang.IllegalStateException: Cannot call sendError() after the response has been committed
enter code here
我有fsame配置你的建議。加上JdbcTokenRepositoryImpl。 所有這一切,我用一個瀏覽器登錄;然後我再次登錄另一個。看起來第二個登錄了,確實如此。 我的問題是,我clik從第一個瀏覽器的鏈接我得到以下異常: 'Estado HTTP 500 - PreparedStatementCallback;錯誤的SQL語法[從persistent_logins中刪除,其中username =?]; [blah blah]:表'gbt.persistent_logins'不存在'。 而表格實際上是從DB中消失的! 有沒有人知道發生了什麼? – kazbeel