From 92d11344fcc04c2790f3407f130928bbe8649b45 Mon Sep 17 00:00:00 2001 From: Mark Dodwell Date: Tue, 3 Dec 2013 00:17:33 -0800 Subject: [PATCH] avoid changing method visibility from omniauth-oauth2 --- lib/omniauth/strategies/facebook.rb | 32 +++++++++++++++-------------- test/test.rb | 4 ++-- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/omniauth/strategies/facebook.rb b/lib/omniauth/strategies/facebook.rb index 23e244c..ed50c21 100644 --- a/lib/omniauth/strategies/facebook.rb +++ b/lib/omniauth/strategies/facebook.rb @@ -67,21 +67,6 @@ def info_options { :params => params } end - def build_access_token - if signed_request_contains_access_token? - hash = signed_request.clone - ::OAuth2::AccessToken.new( - client, - hash.delete('oauth_token'), - hash.merge!(access_token_options.merge(:expires_at => hash.delete('expires'))) - ) - else - with_authorization_code! { super }.tap do |token| - token.options.merge!(access_token_options) - end - end - end - def callback_phase super rescue NoAuthorizationCodeError => e @@ -154,6 +139,23 @@ def signed_request parse_signed_request(raw_signed_request) end + protected + + def build_access_token + if signed_request_contains_access_token? + hash = signed_request.clone + ::OAuth2::AccessToken.new( + client, + hash.delete('oauth_token'), + hash.merge!(access_token_options.merge(:expires_at => hash.delete('expires'))) + ) + else + with_authorization_code! { super }.tap do |token| + token.options.merge!(access_token_options) + end + end + end + private def raw_signed_request diff --git a/test/test.rb b/test/test.rb index 74ab2de..65f0565 100644 --- a/test/test.rb +++ b/test/test.rb @@ -532,13 +532,13 @@ def setup end test 'returns a new access token from the signed request' do - result = strategy.build_access_token + result = strategy.send(:build_access_token) assert_kind_of ::OAuth2::AccessToken, result assert_equal @payload['oauth_token'], result.token end test 'returns an access token with the correct expiry time' do - result = strategy.build_access_token + result = strategy.send(:build_access_token) assert_equal @payload['expires'], result.expires_at end end