Integrating OpenID & Clickpass Authentication in your Rails Application
OpenID is a service, framework, and protocol that is revolutionizing the realm of user authentication and identity services. Started in 2004 by Brad Fitzpatrick, OpenID is now a mature framework supported by major Internet organizations such as AOL, Google, IBM, Microsoft, VeriSign, and Yahoo. It offers a distributed, reliable, and open way for web sites to authenticate their users and saves web developers from the need to write yet another piece of authentication code. 要在每個使用過的網站建立新的帳號,感到疲累嗎?您總是避免上新網站,是否因為每個網站都要求您建立帳號和密碼? 您是否在電腦螢幕旁貼了一堆密碼提示? OpenID 是一種開放技術標準,可解決所有這類問題。透過 OpenID 技術,您可以使用您的 OpenID 帳號隨意在不同的網站上登入或註冊! 在實作這個功能之前,我們需要安裝ruby-openid這個Ruby Gem以及acts_as_authenticated和restful_authentication這兩個Rails Plugin。 接下來我們要先建立openid的資料表並在現有的Users資料表中添加一個identity_url欄位。建立一個遷移檔來新增資料表,然後編輯這個遷移檔: $ ruby script/generate migration CreateOpenidAuthentication 接下來再來建立一個UserOpenid模型,然後編輯這個新的遷移檔: 然後編輯UserOpenid Model: 接下來編輯#{RAILS_ROOT}/config/routes.rb,設定相關的路徑映射: 註:這裡面的controller必須視你...