我想用在 https://github.com/spring-guides/gs-accessing-facebook春社會:「無法獲取ConnectionRepository:沒有用戶登錄」
當我試圖創建JdbcUsersConnectionRepository描述的Facebook登錄,我需要在春季安全班級路徑。 當我加春天的安全我收到
"java.lang.IllegalStateException: Unable to get a ConnectionRepository: no user signed in"
嘗試接收連接
Connection<Facebook> connection = connectionRepository.findPrimaryConnection(Facebook.class);
或檢查時
if (!facebook.isAuthorized())
,當春天的安全性是在類路徑
這一切只發生
你能指點我一個Facebook的UserIdSource實現的例子嗎? 爲了返回用戶ID,我需要知道用戶是否連接。我不能這樣做,因爲我不能撥打 connectionRepository.findPrimaryConnection(Facebook.class) –
@PavelBernshtam您好!爲什麼你的用戶沒有登錄,你試圖獲得他的社會聯繫(SecurityContextHolder.getContext()。getAuthentication()爲空)?社交連接應該對應於任何用戶。看來用戶應該通過用戶名/密碼或服務提供商登錄。你嘗試使用http://docs.spring。IO /彈簧社會/文檔/ 1.0.x系列/參考/ HTML/signin.html? – vitaly256