Permalink
Browse files

opensocial_viewer|owner_idがPOSTパラメターに入っている場合の処理を追加.

  • Loading branch information...
bananagi committed Apr 19, 2011
1 parent ff22aae commit 81a43bb780fd6c0dafbbc5e73a03910792a0aa72
Showing with 14 additions and 3 deletions.
  1. +14 −3 lib/opensocial-wap/session/opensocial_wap_sid.rb
@@ -21,8 +21,7 @@ def extract_session_id(env)
request = ActionDispatch::Request.new(env)
if use_opensocial_wap_sid?(request)
# opensocial_(viewer|owner)_id をsession_idとして使用.
- session_key = request.GET.key?('opensocial_viewer_id') ? 'opensocial_viewer_id' : 'opensocial_owner_id'
- sid = request.GET[session_key]
+ sid = opensocial_user_id(request)
else
# 通常の方法でsession_idを取得.
sid = request.cookies[@key]
@@ -47,14 +46,26 @@ def use_opensocial_wap_sid?(request)
# OAuthの検証にパスしている.
if request.opensocial_oauth_verified?
# opensocial_(viewer|owner)_id がクエリパラメータに存在する.
- if [ 'opensocial_viewer_id', 'opensocial_owner_id'].any? {|p| request.GET.keys.include? p }
+ if opensocial_user_id(request)
return true
end
end
end
end
false
end
+
+ def opensocial_user_id(request)
+ unless @opensocial_user_id
+ params = begin
+ request.GET.update(request.POST)
+ rescue EOFError => e
+ request.GET
+ end
+ @opensocial_user_id = params['opensocial_viewer_id'] || params['opensocial_owner_id']
+ end
+ @opensocial_user_id
+ end
end
end
end

0 comments on commit 81a43bb

Please sign in to comment.