cacanetFukuoka
NPO法人 電子認証局市民ネットワーク福岡
Citizen's Association for Certification Authority network Fukuoka
■CACAnet Fukuokaとは |  ■CACAnet Fukuoka コミュニティ認証局の電子証明書 |  ■CRL一覧

lock.png

お知らせ (25)
イベント (4)
事務会計文書 (2)
技術文書 (36)
東京研究会 (1)
福岡研究会 (8)
運営委員会 (27)



メーリングリスト
寄付
会員一覧
証明書発行システム(開発中)
電子地域通貨
会員専用
リンク集
証明書自動発行サービス(テスト中)

お知らせ

ruby-openidを使ったRPの構築

1.ruby-openidのインストール
# gem install ruby-openid
2.Rails Project作成
$ rails sampleRP
3.Sessionsコントローラー作成
$ ruby script/generate controller sessions new create index destroy complete
4.必要なライブラリのrequire

******************* app/controller/sessions_controller.rb ************
require 'pathname'
require 'openid/store/filesystem'

require 'openid'
require 'openid/extensions/sreg'
require 'openid/extensions/ax'
require 'openid/extensions/pape'
**********************************************************************

5.セッション開始画面作成
********* app/view/sessions/new.erb ****************
<h1>Input OpenID</h1>
<% form_tag(:action => "create") do %>
<%= text_field_tag "openid_identifier" %>
<%= submit_tag "login" %> <% end %> ***************************************************
6.OpenID::Consumerインスタンス作成のメソッドを作成
******************* app/controller/sessions_controller.rb ************
  private

  def rp
    if @rp.nil?
      dir = Pathname.new(RAILS_ROOT).join('db').join('cstore')
      store = OpenID::Store::Filesystem.new(dir)
      @rp = OpenID::Consumer.new(session, store)
    end
    return @rp
  end
**********************************************************************
7.createアクションを作成
******************* app/controller/sessions_controller.rb ************
    begin      identifier = params[:openid_identifier]
      if identifier.nil?        flash[:error] = "OpenIDを入力してください"
        redirect_to :action => 'new'
        return
      end
      # RPインスタンスを生成し、identifierをもとディスカバリを行う
      @oidreq = rp.begin(identifier)
    rescue OpenID::OpenIDError => e
      flash[:error] = "#{identifier}のDiscovery処理が失敗しました: #{e}"
      redirect_to :action => 'new'
      return
    end
    #復帰位置
    return_to = url_for :action => 'complete', :only_path => false
    #REALMを設定(RPのURL)
    realm = url_for :action => 'index', :only_path => false
    #OpenID Request をリダイレクトさせる
    if @oidreq.send_redirect?(realm, return_to, params[:immediate])
      # リダイレクト機能を使う場合
      redirect_to @oidreq.redirect_url(realm, return_to, params[:immediate])
    else
      # JavaScriptを使ってPOSTで強制的にリダイレクトを実現する場合
      render :text => @oidreq.html_markup(realm, return_to, params[:immediate], {'id' => 'openid_form'})
    end
  end
******************************************************************
8.completeアクションの作成
******************* app/controller/sessions_controller.rb ************
  def complete
    current_url = url_for(:action => 'complete', :only_path => false)
    parameters = params.reject{|k,v|request.path_parameters[k]}
    @oidresp = rp.complete(parameters, current_url)
  end
******************************************************************
9.completeビューの作成
****************** app/views/sessions/complete.html.erb *********
<% require 'pp' %>
<h1>complete</h1>
    
<h2>oidresp</h2>
<pre>
<%= h(@oidresp.pretty_inspect) %>
</pre>---------------------------------------------------<br/>
******************************************************************
10.サーバ起動
$ ruby script/server
11.ログイン画面にアクセス
$ http://localhost:3000/sessions/new
Posted by admin at 18:22
イベント

講演会のご案内

【開催日時】

 ≪電子文書保存とヘルスケア≫
   ・2005年3月2日(水) 13:00 ~ 17:30

 ≪地域活性化の戦略ツール
    ~地域通貨・コミュニティ通貨~≫
   ・2005年3月3日(木) 14:00 ~ 16:45

講演会無事終了いたしました
ご参加いただきありがとうございました。

Continue reading "講演会のご案内"
Posted by yamamie at 14:42 | Comments (0) | TrackBack (1)
運営委員会

日時: 2005年11月14日(月曜日)
場所: システムラボラトリー(株)本社
時間: 20:30~22:00
参加者: 山崎・佐塚・宮川・山村

Posted by yamamie at 22:30 | Comments (21) | TrackBack (0)

2009年03月
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
検索


過去の記事
最近の記事
RSS
会員のブログ
萩田 [RSS]
佐塚 [RSS]
宮川 [RSS]
久保 [RSS]
山崎 [RSS]
安河内 [RSS]
田代 [RSS]
山村 [RSS]
西野 [RSS]
長尾 [RSS]
藤野 [RSS]
花田 [RSS]
井上 [RSS]
はやし [RSS]


住所:〒810-0072 福岡県福岡市中央区長浜1丁目3番4号 綾杉ビル北天神2階
TEL:092-761-6182 FAX:092-771-5666
(システムラボラトリー株式会社気付)

CACAnet Fukuoka Community CA 証明書のフィンガープリント

MD5 FE:81:18:A9:75:58:D2:AE:86:D7:79:A6:92:05:C6:29
SHA1 6D:CD:01:1B:F8:FE:FF:67:B2:CB:D5:E5:69:7F:3D:58:57:19:08:0B