2010-04-21 58 views
1

我正在努力使open_id_authentication插件正常工作。
最初是用authlogic做的,但放棄了,因爲它感覺像更多的麻煩幫助。open_id_authentication - 「OpenIdAuthentication.store爲零。使用內存中的存儲。」問題

問題是我在日誌中得到OpenIdAuthentication.store is nil. Using in-memory store.警告,這會阻止正確驗證用戶身份。

這裏是日誌片段:

Processing UserSessionsController#create (for 127.0.0.1 at 2010-04-21 23:58:38) [POST] 
    Parameters: {"commit"=>"Sign in", "authenticity_token"=>"MSPc+VMgsQZ/w7vsb2OiE0azsF1QmphZqfnS6cPRD/U=", "openid_identifier"=>"http://myopenid.com"} 
Completed in 12ms (View: 1, DB: 0) | 401 Unauthorized [http://localhost/user_session] 
Generated checkid_setup request to http://www.myopenid.com/server with assocication {HMAC-SHA1}{4bcf0490}{MN9AXg==} 
OpenIdAuthentication.store is nil. Using in-memory store. 
Error attempting to use stored discovery information: OpenID::TypeURIMismatch 
Attempting discovery to verify endpoint 
Performing discovery on http://xxx.myopenid.com/ 
Using 'check_authentication' with http://www.myopenid.com/server 

我真的不知道我有什麼爲了解決這個問題做。可能將商店設置爲數據庫(並且我有OpenID遷移)。也不知道我是否真的需要數據庫來執行OpenID身份驗證。

原來的項目(分店)是here,所以你可以近距離觀察。

希望對此有好的建議。

謝謝,
德米特里。

回答

3

我遇到了類似的問題,最近的open_id插件和內存存儲。一些OpenID網站可以工作,但大多數不會。 MemoryStore中的某些內容在如何進行身份驗證時被破壞。切換到使用文件存儲爲我工作得很好。

我創建了這裏面名爲config/initializers/openid.rb一個初始化:

OpenIdAuthentication.store = :file 

重新啓動應用程序,我想盡OpenID的URL開始工作。

爲什麼File存儲在Memory存儲沒有時工作,我無法回答。我只知道這爲我修好了。

+1

基於文件的商店存儲只適用於具有單個應用程序服務器的情況。並不安全。所以我需要有數據庫存儲。 – 2010-04-21 22:27:22

+0

如何使用先前版本的插件 - 在他們移除數據庫存儲之前?有一個完整的副本,包含在openid/authlogic插件中: http://github.com/binarylogic/authlogic_openid/tree/master/test/libs/open_id_authentication/ 這應該包括用於設置數據庫的rake任務。也許。 – 2010-04-21 23:07:32

+0

我擺脫了authlogic,並使用普通的'open_id_authentication'來自rails。它仍然不適用於數據庫商店。認爲它使用':file'。 – 2010-04-28 00:34:40