OpenIdAuth
ruby-openi
dをインストール(2.0.4) 1 gem install ruby-openi
d pluginのインストール
1 $ ./script/p
lugin install http://svn .rubyonrai ls.org/rai ls/plugins /open_id_a uthenticat ion/ パッチをあてる
パッチを入手ticket1060
4.diffとして保存
http://dev.rubyonrai ls.org/tic ket/10604 プラグインのところに移動させておく
1 #{RAILS_ROOT
}/vendor/pl ugins/open _id_authen tication/t icket10604 .diff プラグインのルートに移動して、patchを当てる
1 $ patch -p1 < ticket1060
4.diff 2 patching file init.rb 3 Hunk #1 FAILED at 1. 4 1 out of 1 hunk FAILED -- saving rejects to file init.rb.re j 5 patching file lib/genera tors/open_ id_authent ication_ta bles/open_ id_authent ication_ta bles_gener ator.rb 6 patching file lib/genera tors/open_ id_authent ication_ta bles/templ ates/migra tion.rb 7 patching file lib/open_i d_authenti cation.rb 8 Hunk #5 succeeded at 69 with fuzz 1 (offset -2 lines). 9 Hunk #6 succeeded at 88 (offset -2 lines). 10 Hunk #7 succeeded at 152 (offset -2 lines). 11 patching file lib/open_i d_authenti cation/ass ociation.r b 12 patching file lib/open_i d_authenti cation/db_ store.rb 13 patching file lib/open_i d_authenti cation/non ce.rb 14 patching file lib/open_i d_authenti cation/set ting.rb 15 patching file tasks/open _id_authen tication_t asks.rake 16 patching file test/norma lize_test. rb 17 patching file test/open_ id_authent ication_te st.rb 18 patching file test/statu s_test.rb
READMEにあるExampleの作業
テーブル作成
1 rake open_id_au
thenticati on:db:crea te routesに下記を加える
1 map.open_id_co
mplete 'session', :controller => "sessions", :action => "create", :requiremen ts => { :method => :get } 2 map.resource :session SessionsCo
ntroller、vews/sessi ons/new.ht ml.erbの作成
ここでmatakeさんと同じようにはまったのですが、SessionConroller#open_id_au thenticati onをREADMEにあるresult.suc cessful?のほうを使うとプラグインに手を入れずに使うことができます。(agilewebde velopment. comのExampleを使うとNG) 1 def open_id_au
thenticati on 2 authentica te_with_op en_id do |result, identity_u rl| 3 if result.successful ? && @current_us er = @account.users.find_by_id entity_url (identity_u rl) 4 successful _login 5 else 6 failed_log in(result.message || "Sorry, no user by that identity URL exists (#{identity_u rl})") 7 end 8 end 9 end
ruby-openi
dのバージョン指定をはずす 1 #open_id_au
thenticati on/init.rb 2 begin 3 # gem 'ruby-openi d', '=1.1.4' 4 gem 'ruby-openi d'
参考
posted by
satoko
on Wed 27 Feb 2008
at 16:40