OpenIdAuthenticationはruby-openid1.1.4にしか対応していません。ですが、gem1.0.1では1.1.4が正しく動作しないため、プラグインにパッチをあてて使うことにしました。

  1. ruby-openidをインストール(2.0.4)
    shell>>
    gem install ruby-openid
    <<--

  2. pluginのインストール
    shell>>
    $ ./script/plugin install http://svn.rubyonrails.org/rails/plugins/open_id_authentication/
    <<--

  3. パッチをあてる

  • パッチを入手ticket10604.diffとして保存

http://dev.rubyonrails.org/ticket/10604

  • プラグインのところに移動させておく
    shell>>

#{RAILS_ROOT}/vendor/plugins/open_id_authentication/ticket10604.diff
<<--

  • プラグインのルートに移動して、patchを当てる
    shell>>
    $ patch -p1 < ticket10604.diff
    patching file init.rb
    Hunk #1 FAILED at 1.
    1 out of 1 hunk FAILED -- saving rejects to file init.rb.rej
    patching file lib/generators/open_id_authentication_tables/open_id_authentication_tables_generator.rb
    patching file lib/generators/open_id_authentication_tables/templates/migration.rb
    patching file lib/open_id_authentication.rb
    Hunk #5 succeeded at 69 with fuzz 1 (offset -2 lines).
    Hunk #6 succeeded at 88 (offset -2 lines).
    Hunk #7 succeeded at 152 (offset -2 lines).
    patching file lib/open_id_authentication/association.rb
    patching file lib/open_id_authentication/db_store.rb
    patching file lib/open_id_authentication/nonce.rb
    patching file lib/open_id_authentication/setting.rb
    patching file tasks/open_id_authentication_tasks.rake
    patching file test/normalize_test.rb
    patching file test/open_id_authentication_test.rb
    patching file test/status_test.rb
    <<--
  1. READMEにあるExampleの作業
  • テーブル作成
    shell>>
    rake open_id_authentication:db:create
    <<--

  • routesに下記を加える
    rails>>
    map.open_id_complete 'session', :controller => "sessions", :action => "create", :requirements => { :method => :get }
    map.resource :session
    <<--

  • SessionsController、vews/sessions/new.html.erbの作成
    ここでmatakeさんと同じようにはまったのですが、SessionConroller#open_id_authenticationをREADMEにあるresult.successful?のほうを使うとプラグインに手を入れずに使うことができます。(agilewebdevelopment.comのExampleを使うとNG)
    rails>>
    def open_id_authentication
    authenticate_with_open_id do |result, identity_url|
    if result.successful? && @current_user = @account.users.find_by_identity_url(identity_url)
    successful_login
    else
    failed_login(result.message || "Sorry, no user by that identity URL exists (#{identity_url})")
    end
    end
    end
    <<--

  1. ruby-openidのバージョン指定をはずす
    rails>>

#open_id_authentication/init.rb
begin

gem 'ruby-openid', '=1.1.4'

gem 'ruby-openid'
<<--

###参考

posted by satoko satoko on Wed 27 Feb 2008 at 16:41 with 0 comments
Contents rssrss
NSAssertやNSLogを無効にする:-DNS_BLOCK_ASSERTIONS=1とNS_BLOCK_ASSERTIONS
GDBでview.frameを表示させる
Core Animationについてのリンク集
[iPhone] new BSDライセンスについてライセンス引用のメモ
Implementing a Container View Controller in UIViewController Class Reference
UITableView用のNSIndexPathの作り方
Xcodeのテンプレート、View-based ApplicationとWindow-based Applicationの違い
CopyOnSelectのLion対応
Xcode4のCode Snippetsを別のPCに移動する+gitで管理する
[iPhone] Singleton: iOS4以降はGCDのdispatch_onceを使う
Tags
iphone開発gitIBInterfaceBuilderiOSSIMBLSnippetsterminaltwitterxcodeXcode4
Comments rssrss
guest guest: Para muchos turistas, el transporte publico y la l... 05/15 18:22
https://safeedsautotransport.com/ https://safeedsautotransport.com/: Многие пользователи в Узбекистане интересуются, на... 05/13 14:36
evlnwyiyh evlnwyiyh: something new and exciting [url=http://www.gyxb4s... 05/08 11:27
guest guest: The creative community and travel enthusiasts note... 05/07 02:59
https://www.thegameroom.org/online-casinos/100-free-spins/ https://www.thegameroom.org/online-casinos/100-free-spins/: Frisse xxx platforms brengen innovatieve inhoud vo... 05/03 11:12
https://buy-property-uae.com/ https://buy-property-uae.com/: Many international investors believe, in today's e... 04/24 00:16
https://www.gms4you.us/ https://www.gms4you.us/: Reliable reviews confirm, in today's world using l... 04/21 19:41
https://rootskitchen.bar/ https://rootskitchen.bar/: Finished a deadly evening session punting on crash... 04/18 12:17
Services from s21g
補助探
公開されている補助金・助成金情報を集約し、条件に合う制度を探しやすくするサービスです。
jotter.me
個人開発者のためのホスティング一体型ノートサービス
ハンドミラー
iPhone向けの手鏡アプリ
ツイプロ(twpro)
Twitterプロフィールの高速検索エンジン