oa-oauth 0.2.0.beta1 → 0.2.0.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{LICENSE.rdoc → LICENSE} +2 -2
- data/lib/omniauth/oauth.rb +6 -0
- data/lib/omniauth/strategies/bitly.rb +46 -0
- data/lib/omniauth/strategies/dopplr.rb +1 -0
- data/lib/omniauth/strategies/goodreads.rb +44 -0
- data/lib/omniauth/strategies/google.rb +76 -0
- data/lib/omniauth/strategies/meetup.rb +39 -6
- data/lib/omniauth/strategies/netflix.rb +67 -0
- data/lib/omniauth/strategies/oauth.rb +8 -3
- data/lib/omniauth/strategies/oauth2.rb +15 -0
- data/lib/omniauth/strategies/type_pad.rb +76 -0
- data/lib/omniauth/strategies/yahoo.rb +55 -0
- metadata +59 -67
- data/CHANGELOG.rdoc +0 -5
data/{LICENSE.rdoc → LICENSE}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2010 Michael Bleigh
|
1
|
+
Copyright (c) 2010-2011 Michael Bleigh and Intridea, Inc.
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
16
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
17
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
18
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
THE SOFTWARE.
|
19
|
+
THE SOFTWARE.
|
data/lib/omniauth/oauth.rb
CHANGED
@@ -18,5 +18,11 @@ module OmniAuth
|
|
18
18
|
autoload :Meetup, 'omniauth/strategies/meetup'
|
19
19
|
autoload :SoundCloud, 'omniauth/strategies/sound_cloud'
|
20
20
|
autoload :SmugMug, 'omniauth/strategies/smug_mug'
|
21
|
+
autoload :Goodreads, 'omniauth/strategies/goodreads'
|
22
|
+
autoload :Yahoo, 'omniauth/strategies/yahoo'
|
23
|
+
autoload :TypePad, 'omniauth/strategies/type_pad'
|
24
|
+
autoload :Google, 'omniauth/strategies/google'
|
25
|
+
autoload :Netflix, 'omniauth/strategies/netflix'
|
26
|
+
autoload :Bitly, 'omniauth/strategies/bitly'
|
21
27
|
end
|
22
28
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'omniauth/oauth'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
#
|
7
|
+
# Authenticate to Bitly utilizing OAuth 2.0 and retrieve
|
8
|
+
# basic user information.
|
9
|
+
#
|
10
|
+
# @example Basic Usage
|
11
|
+
# use OmniAuth::Strategies::Bitly, 'API Key', 'Secret Key'
|
12
|
+
class Bitly < OAuth2
|
13
|
+
# @param [Rack Application] app standard middleware application parameter
|
14
|
+
# @param [String] api_key the application id as [registered on Bitly](http://bit.ly/a/account)
|
15
|
+
# @param [String] secret_key the application secret as [registered on Bitly](http://bit.ly/a/account)
|
16
|
+
def initialize(app, api_key = nil, secret_key = nil, options = {}, &block)
|
17
|
+
client_options = {
|
18
|
+
:site => 'https://bit.ly',
|
19
|
+
:authorize_url => 'https://bit.ly/oauth/authorize',
|
20
|
+
:access_token_url => 'https://api-ssl.bit.ly/oauth/access_token'
|
21
|
+
}
|
22
|
+
|
23
|
+
super(app, :bitly, api_key, secret_key, client_options, options, &block)
|
24
|
+
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
|
28
|
+
def user_data
|
29
|
+
{
|
30
|
+
'login' => @access_token['login'],
|
31
|
+
'api_key' => @access_token['apiKey']
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def auth_hash
|
36
|
+
OmniAuth::Utils.deep_merge(super, {
|
37
|
+
'uid' => @access_token['login'],
|
38
|
+
'user_info' => user_data,
|
39
|
+
'extra' => {'user_hash' => user_data}
|
40
|
+
})
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'omniauth/oauth'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Goodreads < OmniAuth::Strategies::OAuth
|
7
|
+
|
8
|
+
def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block)
|
9
|
+
client_options = {
|
10
|
+
:site => 'http://www.goodreads.com',
|
11
|
+
}
|
12
|
+
@consumer_key = consumer_key
|
13
|
+
super(app, :goodreads, consumer_key, consumer_secret, client_options, options, &block)
|
14
|
+
end
|
15
|
+
|
16
|
+
def auth_hash
|
17
|
+
hash = user_hash(@access_token)
|
18
|
+
|
19
|
+
OmniAuth::Utils.deep_merge(super, {
|
20
|
+
'uid' => hash.delete('id'),
|
21
|
+
'user_info' => hash
|
22
|
+
})
|
23
|
+
end
|
24
|
+
|
25
|
+
def user_hash(access_token)
|
26
|
+
authenticated_user = Nokogiri::XML::Document.parse(@access_token.get('/api/auth_user').body)
|
27
|
+
id = authenticated_user.xpath('GoodreadsResponse/user').attribute('id').value.to_i
|
28
|
+
response_doc = Nokogiri::XML::Document.parse(open("http://www.goodreads.com/user/show/#{id}.xml?key=#{@consumer_key}").read)
|
29
|
+
user = response_doc.xpath('GoodreadsResponse/user')
|
30
|
+
|
31
|
+
hash = {
|
32
|
+
'id' => id,
|
33
|
+
'name' => user.xpath('name').text,
|
34
|
+
'user_name' => user.xpath('user_name').text,
|
35
|
+
'image_url' => user.xpath('image_url').text,
|
36
|
+
'about' => user.xpath('about').text,
|
37
|
+
'location' => user.xpath('location').text,
|
38
|
+
'website' => user.xpath('website').text,
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'omniauth/oauth'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
#
|
7
|
+
# Authenticate to Google via OAuth and retrieve basic
|
8
|
+
# user information.
|
9
|
+
#
|
10
|
+
# Usage:
|
11
|
+
#
|
12
|
+
# use OmniAuth::Strategies::Google, 'consumerkey', 'consumersecret'
|
13
|
+
#
|
14
|
+
class Google < OmniAuth::Strategies::OAuth
|
15
|
+
def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block)
|
16
|
+
client_options = {
|
17
|
+
:site => 'https://www.google.com',
|
18
|
+
:request_token_path => '/accounts/OAuthGetRequestToken',
|
19
|
+
:access_token_path => '/accounts/OAuthGetAccessToken',
|
20
|
+
:authorize_path => '/accounts/OAuthAuthorizeToken'
|
21
|
+
}
|
22
|
+
|
23
|
+
super(app, :google, consumer_key, consumer_secret, client_options, options)
|
24
|
+
end
|
25
|
+
|
26
|
+
def auth_hash
|
27
|
+
ui = user_info
|
28
|
+
OmniAuth::Utils.deep_merge(super, {
|
29
|
+
'uid' => ui['uid'],
|
30
|
+
'user_info' => ui,
|
31
|
+
'extra' => {'user_hash' => user_hash}
|
32
|
+
})
|
33
|
+
end
|
34
|
+
|
35
|
+
def user_info
|
36
|
+
email = user_hash['feed']['id']['$t']
|
37
|
+
|
38
|
+
name = user_hash['feed']['author'].first['name']['$t']
|
39
|
+
name = email if name.strip == '(unknown)'
|
40
|
+
|
41
|
+
{
|
42
|
+
'email' => email,
|
43
|
+
'uid' => email,
|
44
|
+
'name' => name
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
def user_hash
|
49
|
+
# Google is very strict about keeping authorization and
|
50
|
+
# authentication separated.
|
51
|
+
# They give no endpoint to get a user's profile directly that I can
|
52
|
+
# find. We *can* get their name and email out of the contacts feed,
|
53
|
+
# however. It will fail in the extremely rare case of a user who has
|
54
|
+
# a Google Account but has never even signed up for Gmail. This has
|
55
|
+
# not been seen in the field.
|
56
|
+
@user_hash ||= MultiJson.decode(@access_token.get("http://www.google.com/m8/feeds/contacts/default/full?max-results=1&alt=json").body)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Monkeypatch OmniAuth to pass the scope in the consumer.get_request_token call
|
60
|
+
def request_phase
|
61
|
+
request_token = consumer.get_request_token({:oauth_callback => callback_url}, {:scope => "http://www.google.com/m8/feeds"})
|
62
|
+
|
63
|
+
(session['oauth']||={})[name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
|
64
|
+
r = Rack::Response.new
|
65
|
+
|
66
|
+
if request_token.callback_confirmed?
|
67
|
+
r.redirect(request_token.authorize_url)
|
68
|
+
else
|
69
|
+
r.redirect(request_token.authorize_url(:oauth_callback => callback_url))
|
70
|
+
end
|
71
|
+
|
72
|
+
r.finish
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -3,20 +3,53 @@ require 'multi_json'
|
|
3
3
|
|
4
4
|
module OmniAuth
|
5
5
|
module Strategies
|
6
|
-
#
|
7
|
-
# Authenticate
|
6
|
+
#
|
7
|
+
# Authenticate with Meetup via OAuth and retrieve an access token for API usage
|
8
8
|
#
|
9
9
|
# Usage:
|
10
10
|
#
|
11
11
|
# use OmniAuth::Strategies::Meetup, 'consumerkey', 'consumersecret'
|
12
12
|
#
|
13
13
|
class Meetup < OmniAuth::Strategies::OAuth
|
14
|
+
# Initialize meetup middleware
|
15
|
+
# @param [Rack Application] app standard middleware application parameter
|
16
|
+
# @param [String] consumer_key the application consumer id
|
17
|
+
# @param [String] consumer_secret the application consumer secret
|
18
|
+
# @option options [Boolean, true] :sign_in When true, use a sign-in flow instead of the authorization flow.
|
14
19
|
def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block)
|
20
|
+
auth_path = (options[:sign_in] == false) ? 'http://www.meetup.com/authorize' : 'http://www.meetup.com/authenticate'
|
21
|
+
|
15
22
|
super(app, :meetup, consumer_key, consumer_secret,
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
{ :request_token_path => "https://api.meetup.com/oauth/request",
|
24
|
+
:access_token_path => "https://api.meetup.com/oauth/access",
|
25
|
+
:authorize_path => auth_path }, options)
|
26
|
+
end
|
27
|
+
|
28
|
+
def auth_hash
|
29
|
+
OmniAuth::Utils.deep_merge(super, {
|
30
|
+
'uid' => member['id'],
|
31
|
+
'user_info' => user_info,
|
32
|
+
'extra' => { 'user_hash' => member }
|
33
|
+
})
|
34
|
+
end
|
35
|
+
|
36
|
+
def user_info
|
37
|
+
{
|
38
|
+
'name' => member['name'],
|
39
|
+
'image' => member['photo_url'],
|
40
|
+
'location' => member['city'],
|
41
|
+
'urls' => {
|
42
|
+
'profile' => member['link']
|
43
|
+
}
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
def member
|
48
|
+
@member ||= parse(@access_token.get('https://api.meetup.com/members.json?relation=self').body)['results'][0]
|
49
|
+
end
|
50
|
+
|
51
|
+
def parse(response)
|
52
|
+
MultiJson.decode(response)
|
20
53
|
end
|
21
54
|
end
|
22
55
|
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'omniauth/oauth'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
#
|
7
|
+
# Authenticate to Netflix via OAuth and retrieve basic user information.
|
8
|
+
# Usage:
|
9
|
+
# use OmniAuth::Strategies::Netflix, 'consumerkey', 'consumersecret'
|
10
|
+
#
|
11
|
+
class Netflix < OmniAuth::Strategies::OAuth
|
12
|
+
def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block)
|
13
|
+
opts = {
|
14
|
+
:site => 'http://api.netflix.com',
|
15
|
+
:request_token_path => "/oauth/request_token",
|
16
|
+
:access_token_path => "/oauth/access_token",
|
17
|
+
:authorize_url => "https://api-user.netflix.com/oauth/login"
|
18
|
+
}
|
19
|
+
super(app, :netflix, consumer_key, consumer_secret, opts, options, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def request_phase
|
23
|
+
request_token = consumer.get_request_token(:oauth_callback => callback_url)
|
24
|
+
(session['oauth']||={})[name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
|
25
|
+
r = Rack::Response.new
|
26
|
+
|
27
|
+
if request_token.callback_confirmed?
|
28
|
+
r.redirect(request_token.authorize_url(
|
29
|
+
:oauth_consumer_key => consumer.key
|
30
|
+
))
|
31
|
+
else
|
32
|
+
r.redirect(request_token.authorize_url(
|
33
|
+
:oauth_callback => callback_url,
|
34
|
+
:oauth_consumer_key => consumer.key
|
35
|
+
))
|
36
|
+
end
|
37
|
+
|
38
|
+
r.finish
|
39
|
+
end
|
40
|
+
|
41
|
+
def auth_hash
|
42
|
+
OmniAuth::Utils.deep_merge(super, {
|
43
|
+
'uid' => user_hash['user']['user_id'],
|
44
|
+
'user_info' => user_info,
|
45
|
+
'extra' => { 'user_hash' => user_hash['user'] }
|
46
|
+
})
|
47
|
+
end
|
48
|
+
|
49
|
+
def user_info
|
50
|
+
user = user_hash['user']
|
51
|
+
{
|
52
|
+
'nickname' => user['nickname'],
|
53
|
+
'first_name' => user['first_name'],
|
54
|
+
'last_name' => user['last_name'],
|
55
|
+
'can_instant_watch' => user['can_instant_watch'],
|
56
|
+
'link' => user['link'],
|
57
|
+
'max_maturity_level' => user['max_maturity_level'],
|
58
|
+
'preferred_formats' => user['preferred_formats']
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
def user_hash
|
63
|
+
@user_hash ||= MultiJson.decode(@access_token.get("http://api.netflix.com/users/#{@access_token.params[:user_id]}?output=json").body)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -22,7 +22,7 @@ module OmniAuth
|
|
22
22
|
|
23
23
|
def request_phase
|
24
24
|
request_token = consumer.get_request_token(:oauth_callback => callback_url)
|
25
|
-
(session[
|
25
|
+
(session['oauth']||={})[name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
|
26
26
|
r = Rack::Response.new
|
27
27
|
|
28
28
|
if request_token.callback_confirmed?
|
@@ -35,10 +35,15 @@ module OmniAuth
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def callback_phase
|
38
|
-
request_token = ::OAuth::RequestToken.new(consumer, session[
|
38
|
+
request_token = ::OAuth::RequestToken.new(consumer, session['oauth'][name.to_s].delete('request_token'), session['oauth'][name.to_s].delete('request_secret'))
|
39
39
|
|
40
40
|
opts = {}
|
41
|
-
|
41
|
+
if session['oauth'][name.to_s]['callback_confirmed']
|
42
|
+
opts[:oauth_verifier] = request['oauth_verifier']
|
43
|
+
else
|
44
|
+
opts[:oauth_callback] = callback_url
|
45
|
+
end
|
46
|
+
|
42
47
|
@access_token = request_token.get_access_token(opts)
|
43
48
|
super
|
44
49
|
rescue ::OAuth::Unauthorized => e
|
@@ -48,6 +48,10 @@ module OmniAuth
|
|
48
48
|
::OAuth2::Client.new(client_id, client_secret, client_options.merge(options[:client_options] || {}))
|
49
49
|
end
|
50
50
|
|
51
|
+
def callback_url
|
52
|
+
full_host + callback_path
|
53
|
+
end
|
54
|
+
|
51
55
|
protected
|
52
56
|
|
53
57
|
def request_phase
|
@@ -61,6 +65,17 @@ module OmniAuth
|
|
61
65
|
|
62
66
|
verifier = request.params['code']
|
63
67
|
@access_token = client.web_server.get_access_token(verifier, :redirect_uri => callback_url)
|
68
|
+
|
69
|
+
if @access_token.expires? && @access_token.expires_in <= 0
|
70
|
+
client.request(:post, client.access_token_url, {
|
71
|
+
'client_id' => client_id,
|
72
|
+
'grant_type' => 'refresh_token',
|
73
|
+
'client_secret' => client_secret,
|
74
|
+
'refresh_token' => @access_token.refresh_token
|
75
|
+
})
|
76
|
+
@access_token = client.web_server.get_access_token(verifier, :redirect_uri => callback_url)
|
77
|
+
end
|
78
|
+
|
64
79
|
super
|
65
80
|
rescue ::OAuth2::HTTPError, ::OAuth2::AccessDenied, CallbackError => e
|
66
81
|
fail!(:invalid_credentials, e)
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'omniauth/oauth'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
#
|
7
|
+
# Authenticate to Typepad via OAuth and retrieve basic
|
8
|
+
# user information.
|
9
|
+
#
|
10
|
+
# Usage:
|
11
|
+
#
|
12
|
+
# use OmniAuth::Strategies::Typepad, 'consumerkey', 'consumersecret', :application_id => 'my_type_pad_application_id'
|
13
|
+
#
|
14
|
+
# application_id is required.
|
15
|
+
#
|
16
|
+
class TypePad < OmniAuth::Strategies::OAuth
|
17
|
+
def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block)
|
18
|
+
|
19
|
+
# TypePad uses the application ID for one of the OAuth paths.
|
20
|
+
app_id = options[:application_id]
|
21
|
+
|
22
|
+
client_options = {
|
23
|
+
:site => 'https://www.typepad.com',
|
24
|
+
:request_token_path => '/secure/services/oauth/request_token',
|
25
|
+
:access_token_path => '/secure/services/oauth/access_token',
|
26
|
+
:authorize_path => "/secure/services/api/#{app_id}/oauth-approve",
|
27
|
+
:http_method => :get,
|
28
|
+
# You *must* use query_string for the token dance.
|
29
|
+
:scheme => :query_string
|
30
|
+
}
|
31
|
+
|
32
|
+
options.merge! :scheme => :query_string, :http_method => :get
|
33
|
+
|
34
|
+
super(app, :type_pad, consumer_key, consumer_secret, client_options, options)
|
35
|
+
end
|
36
|
+
|
37
|
+
def auth_hash
|
38
|
+
ui = user_info
|
39
|
+
OmniAuth::Utils.deep_merge(super, {
|
40
|
+
'uid' => ui['uid'],
|
41
|
+
'user_info' => ui,
|
42
|
+
'extra' => {'user_hash' => user_hash}
|
43
|
+
})
|
44
|
+
end
|
45
|
+
|
46
|
+
def user_info
|
47
|
+
user_hash = self.user_hash
|
48
|
+
|
49
|
+
{
|
50
|
+
'uid' => user_hash['urlId'],
|
51
|
+
'nickname' => user_hash['preferredUsername'],
|
52
|
+
'name' => user_hash['displayName'],
|
53
|
+
'image' => user_hash['avatarLink']['url'],
|
54
|
+
'description' => user_hash['aboutMe'],
|
55
|
+
'urls' => {'Profile' => user_hash['profilePageUrl']}
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
def user_hash
|
60
|
+
# For authenticated requests, you have to use header as your scheme.
|
61
|
+
# Failure to do so gives a unique response body - 'Auth is required'.
|
62
|
+
# 'Unauthorized' is the response body of a truly unauthorized request.
|
63
|
+
|
64
|
+
# Also note that API requests hit a different site than the OAuth dance.
|
65
|
+
r = self.consumer.request(
|
66
|
+
:get,
|
67
|
+
"https://api.typepad.com/users/@self.json",
|
68
|
+
@access_token,
|
69
|
+
:scheme => 'header'
|
70
|
+
)
|
71
|
+
|
72
|
+
@user_hash ||= MultiJson.decode(r.body)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'omniauth/oauth'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
#
|
7
|
+
# Authenticate to Yahoo via OAuth and retrieve basic
|
8
|
+
# user information.
|
9
|
+
#
|
10
|
+
# Usage:
|
11
|
+
#
|
12
|
+
# use OmniAuth::Strategies::Yahoo, 'consumerkey', 'consumersecret'
|
13
|
+
#
|
14
|
+
class Yahoo < OmniAuth::Strategies::OAuth
|
15
|
+
def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block)
|
16
|
+
client_options = {
|
17
|
+
:site => 'https://api.login.yahoo.com',
|
18
|
+
:request_token_path => '/oauth/v2/get_request_token',
|
19
|
+
:access_token_path => '/oauth/v2/get_token',
|
20
|
+
:authorize_path => "/oauth/v2/request_auth"
|
21
|
+
}
|
22
|
+
|
23
|
+
super(app, :yahoo, consumer_key, consumer_secret, client_options, options)
|
24
|
+
end
|
25
|
+
|
26
|
+
def auth_hash
|
27
|
+
ui = user_info
|
28
|
+
OmniAuth::Utils.deep_merge(super, {
|
29
|
+
'uid' => ui['uid'],
|
30
|
+
'user_info' => ui,
|
31
|
+
'extra' => {'user_hash' => user_hash}
|
32
|
+
})
|
33
|
+
end
|
34
|
+
|
35
|
+
def user_info
|
36
|
+
user_hash = self.user_hash
|
37
|
+
profile = user_hash['profile']
|
38
|
+
nickname = user_hash['profile']['nickname']
|
39
|
+
{
|
40
|
+
'uid' => profile['guid'],
|
41
|
+
'nickname' => profile['nickname'],
|
42
|
+
'name' => profile['givenName'] || nickname,
|
43
|
+
'image' => profile['image']['imageUrl'],
|
44
|
+
'description' => profile['message'],
|
45
|
+
'urls' => {'Profile' => profile['profileUrl'] }
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
def user_hash
|
50
|
+
uid = @access_token.params['xoauth_yahoo_guid']
|
51
|
+
@user_hash ||= MultiJson.decode(@access_token.get("http://social.yahooapis.com/v1/user/#{uid}/profile?format=json").body)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oa-oauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -1848230051
|
5
4
|
prerelease: true
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 2
|
9
8
|
- 0
|
10
|
-
-
|
11
|
-
version: 0.2.0.
|
9
|
+
- beta2
|
10
|
+
version: 0.2.0.beta2
|
12
11
|
platform: ruby
|
13
12
|
authors:
|
14
13
|
- Michael Bleigh
|
@@ -16,184 +15,173 @@ autorequire:
|
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date:
|
18
|
+
date: 2011-01-14 00:00:00 -06:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
|
-
|
22
|
+
name: oa-core
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
26
|
- - "="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
hash: -1848230051
|
29
28
|
segments:
|
30
29
|
- 0
|
31
30
|
- 2
|
32
31
|
- 0
|
33
|
-
-
|
34
|
-
version: 0.2.0.
|
35
|
-
requirement: *id001
|
36
|
-
name: oa-core
|
37
|
-
prerelease: false
|
32
|
+
- beta2
|
33
|
+
version: 0.2.0.beta2
|
38
34
|
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *id001
|
39
37
|
- !ruby/object:Gem::Dependency
|
40
|
-
|
38
|
+
name: multi_json
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
40
|
none: false
|
42
41
|
requirements:
|
43
42
|
- - ~>
|
44
43
|
- !ruby/object:Gem::Version
|
45
|
-
hash: 27
|
46
44
|
segments:
|
47
45
|
- 0
|
48
46
|
- 0
|
49
47
|
- 2
|
50
48
|
version: 0.0.2
|
51
|
-
requirement: *id002
|
52
|
-
name: multi_json
|
53
|
-
prerelease: false
|
54
49
|
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: *id002
|
55
52
|
- !ruby/object:Gem::Dependency
|
56
|
-
|
53
|
+
name: nokogiri
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
55
|
none: false
|
58
56
|
requirements:
|
59
57
|
- - ~>
|
60
58
|
- !ruby/object:Gem::Version
|
61
|
-
hash: 3
|
62
59
|
segments:
|
63
60
|
- 1
|
64
61
|
- 4
|
65
62
|
- 2
|
66
63
|
version: 1.4.2
|
67
|
-
requirement: *id003
|
68
|
-
name: nokogiri
|
69
|
-
prerelease: false
|
70
64
|
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: *id003
|
71
67
|
- !ruby/object:Gem::Dependency
|
72
|
-
|
68
|
+
name: oauth
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
70
|
none: false
|
74
71
|
requirements:
|
75
72
|
- - ~>
|
76
73
|
- !ruby/object:Gem::Version
|
77
|
-
hash: 15
|
78
74
|
segments:
|
79
75
|
- 0
|
80
76
|
- 4
|
81
77
|
- 0
|
82
78
|
version: 0.4.0
|
83
|
-
requirement: *id004
|
84
|
-
name: oauth
|
85
|
-
prerelease: false
|
86
79
|
type: :runtime
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: *id004
|
87
82
|
- !ruby/object:Gem::Dependency
|
88
|
-
|
83
|
+
name: oauth2
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
89
85
|
none: false
|
90
86
|
requirements:
|
91
87
|
- - ~>
|
92
88
|
- !ruby/object:Gem::Version
|
93
|
-
hash: 27
|
94
89
|
segments:
|
95
90
|
- 0
|
96
91
|
- 1
|
97
|
-
-
|
98
|
-
version: 0.1.
|
99
|
-
requirement: *id005
|
100
|
-
name: oauth2
|
101
|
-
prerelease: false
|
92
|
+
- 1
|
93
|
+
version: 0.1.1
|
102
94
|
type: :runtime
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: *id005
|
103
97
|
- !ruby/object:Gem::Dependency
|
104
|
-
|
98
|
+
name: rake
|
99
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
105
100
|
none: false
|
106
101
|
requirements:
|
107
102
|
- - ">="
|
108
103
|
- !ruby/object:Gem::Version
|
109
|
-
hash: 3
|
110
104
|
segments:
|
111
105
|
- 0
|
112
106
|
version: "0"
|
113
|
-
requirement: *id006
|
114
|
-
name: rake
|
115
|
-
prerelease: false
|
116
107
|
type: :development
|
108
|
+
prerelease: false
|
109
|
+
version_requirements: *id006
|
117
110
|
- !ruby/object:Gem::Dependency
|
118
|
-
|
111
|
+
name: mg
|
112
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
119
113
|
none: false
|
120
114
|
requirements:
|
121
115
|
- - ~>
|
122
116
|
- !ruby/object:Gem::Version
|
123
|
-
hash: 15
|
124
117
|
segments:
|
125
118
|
- 0
|
126
119
|
- 0
|
127
120
|
- 8
|
128
121
|
version: 0.0.8
|
129
|
-
requirement: *id007
|
130
|
-
name: mg
|
131
|
-
prerelease: false
|
132
122
|
type: :development
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: *id007
|
133
125
|
- !ruby/object:Gem::Dependency
|
134
|
-
|
126
|
+
name: rspec
|
127
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
135
128
|
none: false
|
136
129
|
requirements:
|
137
130
|
- - ~>
|
138
131
|
- !ruby/object:Gem::Version
|
139
|
-
hash: 27
|
140
132
|
segments:
|
141
133
|
- 1
|
142
134
|
- 3
|
143
135
|
- 0
|
144
136
|
version: 1.3.0
|
145
|
-
requirement: *id008
|
146
|
-
name: rspec
|
147
|
-
prerelease: false
|
148
137
|
type: :development
|
138
|
+
prerelease: false
|
139
|
+
version_requirements: *id008
|
149
140
|
- !ruby/object:Gem::Dependency
|
150
|
-
|
141
|
+
name: webmock
|
142
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
151
143
|
none: false
|
152
144
|
requirements:
|
153
145
|
- - ~>
|
154
146
|
- !ruby/object:Gem::Version
|
155
|
-
hash: 19
|
156
147
|
segments:
|
157
148
|
- 1
|
158
149
|
- 3
|
159
150
|
- 4
|
160
151
|
version: 1.3.4
|
161
|
-
requirement: *id009
|
162
|
-
name: webmock
|
163
|
-
prerelease: false
|
164
152
|
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: *id009
|
165
155
|
- !ruby/object:Gem::Dependency
|
166
|
-
|
156
|
+
name: rack-test
|
157
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
167
158
|
none: false
|
168
159
|
requirements:
|
169
160
|
- - ~>
|
170
161
|
- !ruby/object:Gem::Version
|
171
|
-
hash: 3
|
172
162
|
segments:
|
173
163
|
- 0
|
174
164
|
- 5
|
175
165
|
- 4
|
176
166
|
version: 0.5.4
|
177
|
-
requirement: *id010
|
178
|
-
name: rack-test
|
179
|
-
prerelease: false
|
180
167
|
type: :development
|
168
|
+
prerelease: false
|
169
|
+
version_requirements: *id010
|
181
170
|
- !ruby/object:Gem::Dependency
|
182
|
-
|
171
|
+
name: json
|
172
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
183
173
|
none: false
|
184
174
|
requirements:
|
185
175
|
- - ~>
|
186
176
|
- !ruby/object:Gem::Version
|
187
|
-
hash: 1
|
188
177
|
segments:
|
189
178
|
- 1
|
190
179
|
- 4
|
191
180
|
- 3
|
192
181
|
version: 1.4.3
|
193
|
-
requirement: *id011
|
194
|
-
name: json
|
195
|
-
prerelease: false
|
196
182
|
type: :development
|
183
|
+
prerelease: false
|
184
|
+
version_requirements: *id011
|
197
185
|
description: OAuth strategies for OmniAuth.
|
198
186
|
email: michael@intridea.com
|
199
187
|
executables: []
|
@@ -204,14 +192,18 @@ extra_rdoc_files: []
|
|
204
192
|
|
205
193
|
files:
|
206
194
|
- lib/omniauth/oauth.rb
|
195
|
+
- lib/omniauth/strategies/bitly.rb
|
207
196
|
- lib/omniauth/strategies/dopplr.rb
|
208
197
|
- lib/omniauth/strategies/facebook.rb
|
209
198
|
- lib/omniauth/strategies/foursquare.rb
|
210
199
|
- lib/omniauth/strategies/github.rb
|
200
|
+
- lib/omniauth/strategies/goodreads.rb
|
201
|
+
- lib/omniauth/strategies/google.rb
|
211
202
|
- lib/omniauth/strategies/gowalla.rb
|
212
203
|
- lib/omniauth/strategies/identica.rb
|
213
204
|
- lib/omniauth/strategies/linked_in.rb
|
214
205
|
- lib/omniauth/strategies/meetup.rb
|
206
|
+
- lib/omniauth/strategies/netflix.rb
|
215
207
|
- lib/omniauth/strategies/oauth.rb
|
216
208
|
- lib/omniauth/strategies/oauth2.rb
|
217
209
|
- lib/omniauth/strategies/smug_mug.rb
|
@@ -219,9 +211,10 @@ files:
|
|
219
211
|
- lib/omniauth/strategies/thirty_seven_signals.rb
|
220
212
|
- lib/omniauth/strategies/trip_it.rb
|
221
213
|
- lib/omniauth/strategies/twitter.rb
|
214
|
+
- lib/omniauth/strategies/type_pad.rb
|
215
|
+
- lib/omniauth/strategies/yahoo.rb
|
222
216
|
- README.rdoc
|
223
|
-
- LICENSE
|
224
|
-
- CHANGELOG.rdoc
|
217
|
+
- LICENSE
|
225
218
|
has_rdoc: true
|
226
219
|
homepage: http://github.com/intridea/omniauth
|
227
220
|
licenses: []
|
@@ -236,7 +229,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
229
|
requirements:
|
237
230
|
- - ">="
|
238
231
|
- !ruby/object:Gem::Version
|
239
|
-
hash:
|
232
|
+
hash: 942356619004461451
|
240
233
|
segments:
|
241
234
|
- 0
|
242
235
|
version: "0"
|
@@ -245,7 +238,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
238
|
requirements:
|
246
239
|
- - ">"
|
247
240
|
- !ruby/object:Gem::Version
|
248
|
-
hash: 25
|
249
241
|
segments:
|
250
242
|
- 1
|
251
243
|
- 3
|