Advertisement
Advertisement

More Related Content

Advertisement

丸山先生レクチャーシリーズ2007-2008

  1. Ruby on Rails2.0 における REST 対応 丸山先生レクチャーシリーズ ~ RESTful サービス技術の台頭~ よういちろう 2007/12/18 (c) 2007 Yoichiro Tanaka. All rights Reserved. 05/29/09
  2. Ruby on Rails における REST 2007/12/18 (c) 2007 Yoichiro Tanaka. All rights Reserved. 05/29/09
  3. RESTful サービスへのアクセス 2007/12/18 (c) 2007 Yoichiro Tanaka. All rights Reserved. Person.find(:all) # => GET /people.xml Person.find(:all, :params => { :title => "CEO" }) # => GET /people.xml?title=CEO Person.find(:first, :from => :managers) # => GET /people/managers.xml Person.find(:all, :from => "/companies/1/people.xml") # => GET /companies/1/people.xml Person.find(:one, :from => :leader) # => GET /people/leader.xml Person.find(:one, :from => "/companies/1/manager.xml") # => GET /companies/1/manager.xml StreetAddress.find(1, :params => { :person_id => 1 }) # => GET /people/1/street_addresses/1.xml
  4. 認証処理 2007/12/18 (c) 2007 Yoichiro Tanaka. All rights Reserved. require ‘base64’ def auth_wsse @@wsse_pattern ||= /^UsernameToken Username="([^"]+)",PasswordDigest= "([^"]+)",Nonce="([^"]+)",Created="([^"]+)"$/ if request.env['HTTP_X_WSSE'] && @@wsse_pattern =~ request.env['HTTP_X_WSSE'] username = $1 passwd = Base64.decode64($2) nonce = Base64.decode64($3) created = $4 return username == ‘yoichiro‘ && Digest::SHA1.digest( nonce + created + ‘pass’) == passwd else ・・・ end 正規表現により認証情報を取得 パスワードと付加情報から SHA1 ダイジェストを生成し比較 これも before フィルタとしておけば便利
Advertisement