omniauth_china 0.0.3 → 0.0.4.beta1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,8 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth_china (0.0.2)
5
- omniauth
4
+ omniauth_china (0.0.3)
5
+ multi_json (~> 0.0.2)
6
+ nokogiri (~> 1.4.2)
7
+ oa-core (~> 0.2.0.beta1)
8
+ oa-oauth (~> 0.2.0.beta1)
9
+ oauth (~> 0.4.0)
10
+ oauth2 (~> 0.1.0)
6
11
 
7
12
  GEM
8
13
  remote: http://rubygems.org/
@@ -73,54 +78,23 @@ GEM
73
78
  mime-types (1.16)
74
79
  multi_json (0.0.5)
75
80
  multipart-post (1.1.0)
76
- net-ldap (0.1.1)
77
81
  nokogiri (1.4.4)
78
- oa-basic (0.2.0)
79
- multi_json (~> 0.0.2)
80
- nokogiri (~> 1.4.2)
81
- oa-core (= 0.2.0)
82
- rest-client (~> 1.6.0)
83
82
  oa-core (0.2.0)
84
83
  rack (~> 1.1)
85
- oa-enterprise (0.2.0)
86
- net-ldap (~> 0.1.1)
87
- nokogiri (~> 1.4.2)
88
- oa-core (= 0.2.0)
89
- pyu-ruby-sasl (~> 0.0.3.1)
90
- rubyntlm (~> 0.1.1)
91
- oa-more (0.2.0)
92
- multi_json (~> 0.0.2)
93
- oa-core (= 0.2.0)
94
- rest-client (~> 1.6.0)
95
84
  oa-oauth (0.2.0)
96
85
  multi_json (~> 0.0.2)
97
86
  nokogiri (~> 1.4.2)
98
87
  oa-core (= 0.2.0)
99
88
  oauth (~> 0.4.0)
100
89
  oauth2 (~> 0.1.1)
101
- oa-openid (0.2.0)
102
- oa-core (= 0.2.0)
103
- rack-openid (~> 1.2.0)
104
- ruby-openid-apps-discovery
105
90
  oauth (0.4.4)
106
91
  oauth2 (0.1.1)
107
92
  faraday (~> 0.5.0)
108
93
  multi_json (~> 0.0.4)
109
- omniauth (0.2.0)
110
- oa-basic (= 0.2.0)
111
- oa-core (= 0.2.0)
112
- oa-enterprise (= 0.2.0)
113
- oa-more (= 0.2.0)
114
- oa-oauth (= 0.2.0)
115
- oa-openid (= 0.2.0)
116
94
  polyglot (0.3.1)
117
- pyu-ruby-sasl (0.0.3.2)
118
95
  rack (1.2.2)
119
96
  rack-mount (0.6.14)
120
97
  rack (>= 1.0.0)
121
- rack-openid (1.2.0)
122
- rack (>= 1.1.0)
123
- ruby-openid (>= 2.1.8)
124
98
  rack-test (0.5.7)
125
99
  rack (>= 1.0)
126
100
  rails (3.0.3)
@@ -137,8 +111,6 @@ GEM
137
111
  rake (>= 0.8.7)
138
112
  thor (~> 0.14.4)
139
113
  rake (0.8.7)
140
- rest-client (1.6.1)
141
- mime-types (>= 1.16)
142
114
  rspec (2.0.1)
143
115
  rspec-core (~> 2.0.1)
144
116
  rspec-expectations (~> 2.0.1)
@@ -149,10 +121,6 @@ GEM
149
121
  rspec-mocks (2.0.1)
150
122
  rspec-core (~> 2.0.1)
151
123
  rspec-expectations (~> 2.0.1)
152
- ruby-openid (2.1.8)
153
- ruby-openid-apps-discovery (1.2.0)
154
- ruby-openid (>= 2.1.7)
155
- rubyntlm (0.1.1)
156
124
  rubyzip (0.9.4)
157
125
  selenium-webdriver (0.1.4)
158
126
  childprocess (>= 0.1.7)
@@ -177,7 +145,12 @@ DEPENDENCIES
177
145
  capybara (>= 0.4.0)
178
146
  json (~> 1.4.3)
179
147
  mg (~> 0.0.8)
180
- omniauth
148
+ multi_json (~> 0.0.2)
149
+ nokogiri (~> 1.4.2)
150
+ oa-core (~> 0.2.0.beta1)
151
+ oa-oauth (~> 0.2.0.beta1)
152
+ oauth (~> 0.4.0)
153
+ oauth2 (~> 0.1.0)
181
154
  omniauth_china!
182
155
  rack
183
156
  rack-test (~> 0.5.4)
data/README.markdown ADDED
@@ -0,0 +1,71 @@
1
+ # OmniAuth: Standardized Multi-Provider Authentication
2
+
3
+ OmniAuth is a new Rack-based authentication system for multi-provider external authentcation. OmniAuth is built from the ground up on the philosophy that **authentication is not the same as identity**, and is based on two observations:
4
+
5
+ # OmniAuthChina (omniauth_china)
6
+
7
+ OmniAuth China is an extention of OmniAuth, it addes Open ID providers in China such as Douban, Sina, Sohu, 163, Tencent, Renren, etc.
8
+
9
+ ## Installation
10
+
11
+ To install OmniAuthChina, simply install the gem:
12
+
13
+ gem install omniauth_china
14
+
15
+ ## Providers
16
+
17
+ OmniAuth currently supports the following external providers:
18
+
19
+ * via OAuth
20
+ * Douban (credit: [rainux](http://github.com/rainux))
21
+ * Tsina (credit: [he9qi](http://github.com/he9qi))
22
+ * T163 (credit: [he9qi](http://github.com/he9qi))
23
+ * Tsohu (credit: [he9qi](http://github.com/he9qi))
24
+ * Tqq (credit: [he9qi](http://github.com/he9qi))
25
+ * Renren (Renren Connect of renren.com) (credit: [taweili](http://github.com/taweili), [rainux](http://github.com/rainux))
26
+
27
+ ## 人人
28
+
29
+ Run the generator to generate `xd_receiver.html` and include helper into ApplicationHelper:
30
+
31
+ rails g omniauth_renren:install
32
+
33
+ Place the Renren Connect button on any page by simply call `omniauth_renren_connect_button` and `omniauth_renren_javascript`:
34
+
35
+ <%= omniauth_renren_connect_button %>
36
+ <%= omniauth_renren_javascript %>
37
+
38
+ Route `/auth/renren` to the page that contain Renren Connect button:
39
+
40
+ match '/auth/renren' => 'users#show'
41
+
42
+ ## Usage
43
+
44
+ OmniAuth is a collection of Rack middleware. To use a single strategy, you simply need to add the middleware:
45
+
46
+ require 'oa-oauth'
47
+ use OmniAuth::Strategies::Twitter, 'CONSUMER_KEY', 'CONSUMER_SECRET'
48
+
49
+ Now to initiate authentication you merely need to redirect the user to `/auth/twitter` via a link or other means. Once the user has authenticated to Twitter, they will be redirected to `/auth/twitter/callback`. You should build an endpoint that handles this URL, at which point you will will have access to the authentication information through the `omniauth.auth` parameter of the Rack environment. For example, in Sinatra you would do something like this:
50
+
51
+ get '/auth/twitter/callback' do
52
+ auth_hash = request.env['omniauth.auth']
53
+ end
54
+
55
+ The hash in question will look something like this:
56
+
57
+ {
58
+ 'uid' => '12356',
59
+ 'provider' => 'twitter',
60
+ 'user_info' => {
61
+ 'name' => 'User Name',
62
+ 'nickname' => 'username',
63
+ # ...
64
+ }
65
+ }
66
+
67
+ The `user_info` hash will automatically be populated with as much information about the user as OmniAuth was able to pull from the given API or authentication provider.
68
+
69
+ ## TODO
70
+
71
+ Write better tests!!
data/lib/LICENSE.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Qi He.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,15 @@
1
+ module OmniauthRenren
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ def copy_files
6
+ copy_file 'public/xd_receiver.html'
7
+ end
8
+
9
+ def include_helper
10
+ inject_into_file 'app/helpers/application_helper.rb', :after => "module ApplicationHelper\n" do
11
+ " include OmniAuth::Strategies::Renren::Helper\n"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
+ </head>
6
+ <body>
7
+ <script src="http://static.connect.renren.com/js/v1.0/XdCommReceiver.jsp" type="text/javascript"></script>
8
+ </body>
9
+ </html>
@@ -6,5 +6,7 @@ module OmniAuth
6
6
  autoload :Tsina, 'omniauth_china/strategies/tsina'
7
7
  autoload :T163, 'omniauth_china/strategies/t163'
8
8
  autoload :Tsohu, 'omniauth_china/strategies/tsohu'
9
+ autoload :Tqq, 'omniauth_china/strategies/tqq'
10
+ autoload :Renren, 'omniauth_china/strategies/renren'
9
11
  end
10
12
  end
@@ -0,0 +1,141 @@
1
+ module OmniAuth
2
+ module Strategies
3
+ class Renren
4
+ module Helper
5
+ def omniauth_renren_connect_button
6
+ callback_path = "#{OmniAuth.config.path_prefix}/renren/callback"
7
+ @renren_connect_form_id = 'omniauth_renren_connect_form'
8
+
9
+ if defined?(::ActionView::Helpers::FormTagHelper)
10
+
11
+ form_tag(callback_path, :id => @renren_connect_form_id) do
12
+ renren_connect_button.html_safe
13
+ end
14
+ else
15
+
16
+ <<-HTML
17
+ <form accept-charset="UTF-8" action="#{callback_path}" id="#{@renren_connect_form_id}" method="post">
18
+ #{renren_connect_button}
19
+ </form>
20
+ HTML
21
+ end
22
+ end
23
+
24
+ def omniauth_simple_renren_connect_button(options = {})
25
+ params = {
26
+ :src => "http://pics.wanlibo.com/images_cn/registration/renren.png",
27
+ :title => "renren connect",
28
+ :alt => "renren connect"
29
+ }.merge(options)
30
+
31
+ p = ""
32
+ params.each do |k, v|
33
+ p += k.to_s + "='" + v + "' "
34
+ end
35
+ simple_renren_connect_button(p).html_safe
36
+ end
37
+
38
+ def omniauth_renren_friends(options = {})
39
+ params = {
40
+ :max_rows => "2",
41
+ :face_space => "5",
42
+ :width => "217"
43
+ }.merge(options)
44
+ renren_friends(params).html_safe
45
+ end
46
+
47
+ def omniauth_renren_live_widget(options = {})
48
+ params = {
49
+ :width => "370px",
50
+ :height => "390px"
51
+ }.merge(options)
52
+ renren_live_widget(params).html_safe
53
+ end
54
+
55
+ def omniauth_renren_like_button(options = {})
56
+ params = {
57
+ :width => "200px",
58
+ :height => "70px",
59
+ :url => root_url
60
+ }.merge(options)
61
+ renren_like_button(params).html_safe
62
+ end
63
+
64
+ def omniauth_renren_invite(options = {})
65
+ params = {
66
+ :content => "Join us",
67
+ :url1 => "http://www.renren.com",
68
+ :label1 => "Go",
69
+ :url2 => "http://apps.renren.com/yourapp",
70
+ :label2 => "Accept",
71
+ :action => "/yourapp/youraction",
72
+ :friend_text => "Invite your friends",
73
+ :max => "5",
74
+ :mode => "all",
75
+ :width => "735",
76
+ :height => "450"
77
+ }.merge(options)
78
+ renren_invite(params).html_safe
79
+ end
80
+
81
+ def omniauth_renren_javascript
82
+ renren_javascript.html_safe
83
+ end
84
+
85
+ private
86
+
87
+ def renren_invite(options)
88
+ <<-HTML
89
+ <xn:serverxnml>
90
+ <script type="text/xnml">
91
+ <xn:request-form content="#{options[:content]} &lt;xn:req-choice url=&quot;#{options[:url1]}&quot; label=&quot;#{options[:label1]}&quot;&gt;&lt;xn:req-choice url=&quot;#{options[:url2]}&quot; label=&quot;#{options[:label2]}&quot;&gt;" action="#{options[:action]}">
92
+ <xn:multi-friend-selector-x actiontext="#{options[:friend_text]}" max="#{options[:max]}" mode="#{options[:mode]}" width="#{options[:width]}" height="#{options[:height]}" />
93
+ </xn:request-form></script></xn:serverxnml>
94
+ HTML
95
+ end
96
+
97
+ def renren_like_button(options = {})
98
+ <<-HTML
99
+ <iframe scrolling="no" frameborder="0" allowtransparency="true" src="http://www.connect.renren.com/like?url=#{options[:url]}" style="width: #{options[:width]};height: #{options[:height]};"></iframe>
100
+ HTML
101
+ end
102
+
103
+ def renren_live_widget(options = {})
104
+ <<-HTML
105
+ <iframe scrolling="no" frameborder="0" src="http://www.connect.renren.com/widget/liveWidget?api_key=#{Renren.api_key}&xid=default&desp=%E5%A4%A7%E5%AE%B6%E6%9D%A5%E8%AE%A8%E8%AE%BA" style="width: #{options[:width]};height: #{options[:height]};"></iframe>
106
+ HTML
107
+ end
108
+
109
+ def renren_friends(options = {})
110
+ <<-HTML
111
+ <xn:friendpile show-faces="all" face-size="small" max-rows="#{options[:max_rows]}" face-space="#{options[:face_space]}" width="#{options[:width]}"></xn:friendpile>
112
+ HTML
113
+ end
114
+
115
+ def simple_renren_connect_button(properties)
116
+ callback_path = "#{OmniAuth.config.path_prefix}/renren/callback"
117
+ <<-HTML
118
+ <img #{properties} onclick="XN.Connect.requireSession(function(){window.location.href='#{callback_path}';});return false;"></img>
119
+ HTML
120
+ end
121
+
122
+ def renren_connect_button
123
+ <<-HTML
124
+ <xn:login-button autologoutlink="true" onlogin="document.getElementById('#{@renren_connect_form_id}').submit();"></xn:login-button>
125
+ HTML
126
+ end
127
+
128
+ def renren_javascript
129
+ <<-HTML
130
+ <script src="http://static.connect.renren.com/js/v1.0/FeatureLoader.jsp" type="text/javascript"></script>
131
+ <script type="text/javascript">
132
+ //<![CDATA[
133
+ XN_RequireFeatures(['EXNML'], function(){ XN.Main.init('#{Renren.api_key}', '/xd_receiver.html'); });
134
+ //]]>
135
+ </script>
136
+ HTML
137
+ end
138
+ end
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,22 @@
1
+ require 'net/http'
2
+ require 'pp'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Renren
7
+ class Service
8
+ DEBUG = false
9
+
10
+ def post(params)
11
+ pp "### Posting Params: #{params.inspect}" if DEBUG
12
+ Net::HTTP.post_form(url, params)
13
+ end
14
+
15
+ private
16
+ def url
17
+ URI.parse('http://api.renren.com/restserver.do')
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,99 @@
1
+ require 'digest/md5'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Renren
7
+ class Session
8
+ class IncorrectSignature < Exception; end
9
+ class SessionExpired < Exception; end
10
+ class OtherException < Exception; end
11
+
12
+ attr_reader :session_key
13
+ attr_reader :expires
14
+ attr_reader :uid
15
+
16
+ def initialize(cookies)
17
+ options = extract_renren_cookies(cookies)
18
+ @expires = options['expires'] ? Integer(options['expires']) : 0
19
+ @session_key = options['session_key']
20
+ @uid = options['user']
21
+ end
22
+
23
+ def user
24
+ @user ||= invoke_method('users.getInfo', :uids => @uid, :format => :json).first
25
+ end
26
+
27
+ def infinite?
28
+ @expires == 0
29
+ end
30
+
31
+ def expired?
32
+ @expires.nil? || (!infinite? && Time.at(@expires) <= Time.now)
33
+ end
34
+
35
+ def secured?
36
+ !@session_key.nil? && !expired?
37
+ end
38
+
39
+ def invoke_method(method, params = {})
40
+ xn_params = {
41
+ :method => method,
42
+ :api_key => Renren.api_key,
43
+ :session_key => session_key,
44
+ :call_id => Time.now.to_i,
45
+ :v => '1.0',
46
+ :format => :json
47
+ }
48
+ xn_params.merge!(params) if params
49
+ xn_params.merge!(:sig => compute_sig(xn_params))
50
+ MultiJson.decode(Service.new.post(xn_params).body)
51
+ end
52
+
53
+ class << self
54
+ private
55
+ def verify_signature(renren_sig_params, expected_signature)
56
+ raise Renren::Session::IncorrectSignature if compute_sig(renren_sig_params) != expected_signature
57
+ # raise Renren::Session::SignatureTooOld if renren_sig_params['time'] && Time.at(renren_sig_params['time'].to_f) < earliest_valid_session
58
+ true
59
+ end
60
+
61
+ def compute_sig(params)
62
+ raw_string = params.collect {|*args| args.join('=') }.sort.join
63
+ actual_sig = Digest::MD5.hexdigest([raw_string, Renren.secret_key].join)
64
+ end
65
+ end
66
+
67
+ private
68
+ def extract_renren_cookies(cookies)
69
+ parsed = {}
70
+ xn_cookie_names(cookies).each { |key| parsed[key[xn_cookie_prefix.size, key.size]] = cookies[key] }
71
+
72
+ # #returning gracefully if the cookies aren't set or have expired
73
+ # return unless parsed['session_key'] && parsed['user'] && parsed['expires'] && parsed['ss']
74
+ # # TODO: check expires, why it alway less than Time.now
75
+ # return unless (Time.at(parsed['expires'].to_s.to_f) > Time.now) || (parsed['expires'] == "0")
76
+ # #if we have the unexpired cookies, we'll throw an exception if the sig doesn't verify
77
+ verify_signature(parsed, cookies[Renren.api_key])
78
+ parsed
79
+ end
80
+
81
+ def xn_cookie_names(cookies)
82
+ xn_cookie_names = cookies.keys.select {|k| k && k.starts_with?(xn_cookie_prefix) }
83
+ end
84
+
85
+ def xn_cookie_prefix
86
+ Renren.api_key + '_'
87
+ end
88
+
89
+ def verify_signature(renren_sig_params, expected_signature)
90
+ self.class.send :verify_signature, renren_sig_params, expected_signature
91
+ end
92
+
93
+ def compute_sig(params)
94
+ self.class.send :compute_sig, params
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,48 @@
1
+ require 'omniauth_china/oauth_china'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Renren
6
+ include OmniAuth::Strategy
7
+ autoload :Session, 'omniauth_china/strategies/renren/session'
8
+ autoload :Service, 'omniauth_china/strategies/renren/service'
9
+ autoload :Helper, 'omniauth_china/strategies/renren/helper'
10
+
11
+ class << self
12
+ def api_key
13
+ @@api_key
14
+ end
15
+
16
+ def secret_key
17
+ @@secret_key
18
+ end
19
+ end
20
+
21
+ def initialize(app, api_key, secret_key, options = {})
22
+ @@api_key = api_key
23
+ @@secret_key = secret_key
24
+
25
+ super(app, :renren, options)
26
+ end
27
+
28
+ def request_phase
29
+ @response.finish
30
+ end
31
+
32
+ def callback_phase
33
+ @renren_session = Renren::Session.new(request.cookies)
34
+ super
35
+ end
36
+
37
+ def auth_hash
38
+ OmniAuth::Utils.deep_merge(super, {
39
+ 'uid' => @renren_session.uid,
40
+ 'user_info' => @renren_session.user,
41
+ 'extra' => {
42
+ 'renren_session' => @renren_session
43
+ }
44
+ })
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,64 @@
1
+ require 'omniauth/oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ #
7
+ # Authenticate to Tqq via OAuth and retrieve basic
8
+ # user information.
9
+ #
10
+ # Usage:
11
+ #
12
+ # use OmniAuth::Strategies::Tqq, 'APIKey', 'APIKeySecret'
13
+ #
14
+ class Tqq < OmniAuth::Strategies::OAuth
15
+
16
+ def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block)
17
+ @api_key = consumer_key
18
+
19
+ client_options = {
20
+ :site => 'https://open.t.qq.com',
21
+ :request_token_path => '/cgi-bin/request_token',
22
+ :access_token_path => '/cgi-bin/access_token',
23
+ :authorize_path => '/cgi-bin/authorize',
24
+ :realm => 'OmniAuth',
25
+ :scheme => :query_string,
26
+ :nonce => nonce,
27
+ :http_method => :get,
28
+ }
29
+
30
+ super(app, :tqq, consumer_key, consumer_secret, client_options, options, &block)
31
+ end
32
+
33
+ def nonce
34
+ Base64.encode64(OpenSSL::Random.random_bytes(32)).gsub(/\W/, '')[0, 32]
35
+ end
36
+
37
+ def auth_hash
38
+ OmniAuth::Utils.deep_merge(super, {
39
+ 'uid' => user_hash["data"]['uid'],
40
+ 'user_info' => user_info,
41
+ 'extra' => {'user_hash' => user_hash}
42
+ })
43
+ end
44
+
45
+ def user_info
46
+ user_hash = self.user_hash
47
+ {
48
+ 'username' => user_hash["data"]['name'],
49
+ 'name' => user_hash["data"]['nick'],
50
+ 'location' => user_hash["data"]['location'],
51
+ 'image' => user_hash["data"]['head'],
52
+ 'description' => user_hash['description'],
53
+ 'urls' => {
54
+ 'Tqq' => 't.qq.com'
55
+ }
56
+ }
57
+ end
58
+
59
+ def user_hash
60
+ @user_hash ||= MultiJson.decode(@access_token.get("http://open.t.qq.com/api/user/info?format=json").body)
61
+ end
62
+ end
63
+ end
64
+ end
@@ -21,7 +21,7 @@ module OmniAuth
21
21
  :request_token_path => '/oauth/request_token',
22
22
  :access_token_path => '/oauth/access_token',
23
23
  :authorize_path => '/oauth/authorize',
24
- :realm => 'OmniAuth'
24
+ :scheme => :header,
25
25
  }
26
26
 
27
27
  super(app, :tsohu, consumer_key, consumer_secret, client_options, options, &block)
@@ -1,3 +1,3 @@
1
1
  module OmniauthChina
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4.beta1"
3
3
  end
@@ -9,12 +9,17 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["Qi He"]
10
10
  s.email = ["qihe229@gmail.com"]
11
11
  s.homepage = "http://rubygems.org/gems/omniauth_china"
12
- s.summary = %q{OmniAuth extention: omniauth for china}
13
- s.description = %q{This is an extention of OmniAuth, it addes Open ID providers in China such as Douban, Sina, Sohu, 163, etc.}
12
+ s.summary = %q{OmniAuth extension: omniauth for china}
13
+ s.description = %q{This is an extention of OmniAuth, it addes Open ID providers in China such as Douban, Sina, Sohu, 163, Tencent, Renren, etc.}
14
14
 
15
15
  s.rubyforge_project = "omniauth_china"
16
16
 
17
- s.add_dependency 'omniauth'
17
+ s.add_dependency 'oa-core', '~> 0.2.0.beta1'
18
+ s.add_dependency 'oa-oauth', '~> 0.2.0.beta1'
19
+ s.add_dependency 'multi_json', '~> 0.0.2'
20
+ s.add_dependency 'nokogiri', '~> 1.4.2'
21
+ s.add_dependency 'oauth', '~> 0.4.0'
22
+ s.add_dependency 'oauth2', '~> 0.1.0'
18
23
 
19
24
  s.files = `git ls-files`.split("\n")
20
25
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -0,0 +1,5 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe OmniAuth::Strategies::Tqq do
4
+ it_should_behave_like "an oauth strategy"
5
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth_china
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ prerelease: true
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ - beta1
10
+ version: 0.0.4.beta1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Qi He
@@ -18,19 +19,98 @@ date: 2011-03-26 00:00:00 -07:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: omniauth
22
+ name: oa-core
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
24
25
  none: false
25
26
  requirements:
26
- - - ">="
27
+ - - ~>
27
28
  - !ruby/object:Gem::Version
28
29
  segments:
29
30
  - 0
30
- version: "0"
31
+ - 2
32
+ - 0
33
+ - beta1
34
+ version: 0.2.0.beta1
31
35
  type: :runtime
32
36
  version_requirements: *id001
33
- description: This is an extention of OmniAuth, it addes Open ID providers in China such as Douban, Sina, Sohu, 163, etc.
37
+ - !ruby/object:Gem::Dependency
38
+ name: oa-oauth
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ segments:
46
+ - 0
47
+ - 2
48
+ - 0
49
+ - beta1
50
+ version: 0.2.0.beta1
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: multi_json
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ segments:
62
+ - 0
63
+ - 0
64
+ - 2
65
+ version: 0.0.2
66
+ type: :runtime
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: nokogiri
70
+ prerelease: false
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ segments:
77
+ - 1
78
+ - 4
79
+ - 2
80
+ version: 1.4.2
81
+ type: :runtime
82
+ version_requirements: *id004
83
+ - !ruby/object:Gem::Dependency
84
+ name: oauth
85
+ prerelease: false
86
+ requirement: &id005 !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ~>
90
+ - !ruby/object:Gem::Version
91
+ segments:
92
+ - 0
93
+ - 4
94
+ - 0
95
+ version: 0.4.0
96
+ type: :runtime
97
+ version_requirements: *id005
98
+ - !ruby/object:Gem::Dependency
99
+ name: oauth2
100
+ prerelease: false
101
+ requirement: &id006 !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ~>
105
+ - !ruby/object:Gem::Version
106
+ segments:
107
+ - 0
108
+ - 1
109
+ - 0
110
+ version: 0.1.0
111
+ type: :runtime
112
+ version_requirements: *id006
113
+ description: This is an extention of OmniAuth, it addes Open ID providers in China such as Douban, Sina, Sohu, 163, Tencent, Renren, etc.
34
114
  email:
35
115
  - qihe229@gmail.com
36
116
  executables: []
@@ -43,17 +123,27 @@ files:
43
123
  - .gitignore
44
124
  - Gemfile
45
125
  - Gemfile.lock
126
+ - README.markdown
46
127
  - Rakefile
128
+ - lib/LICENSE.rdoc
129
+ - lib/generators/omniauth_renren/install/install_generator.rb
130
+ - lib/generators/omniauth_renren/install/templates/public/xd_receiver.html
47
131
  - lib/omniauth_china.rb
48
132
  - lib/omniauth_china/oauth_china.rb
49
133
  - lib/omniauth_china/strategies/douban.rb
134
+ - lib/omniauth_china/strategies/renren.rb
135
+ - lib/omniauth_china/strategies/renren/helper.rb
136
+ - lib/omniauth_china/strategies/renren/service.rb
137
+ - lib/omniauth_china/strategies/renren/session.rb
50
138
  - lib/omniauth_china/strategies/t163.rb
139
+ - lib/omniauth_china/strategies/tqq.rb
51
140
  - lib/omniauth_china/strategies/tsina.rb
52
141
  - lib/omniauth_china/strategies/tsohu.rb
53
142
  - lib/omniauth_china/version.rb
54
143
  - omniauth_china.gemspec
55
144
  - spec/omniauth_china/strategies/douban_spec.rb
56
145
  - spec/omniauth_china/strategies/t163_spec.rb
146
+ - spec/omniauth_china/strategies/tqq_spec.rb
57
147
  - spec/omniauth_china/strategies/tsina_spec.rb
58
148
  - spec/omniauth_china/strategies/tsohu_spec.rb
59
149
  - spec/spec_helper.rb
@@ -119,21 +209,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
209
  required_rubygems_version: !ruby/object:Gem::Requirement
120
210
  none: false
121
211
  requirements:
122
- - - ">="
212
+ - - ">"
123
213
  - !ruby/object:Gem::Version
124
214
  segments:
125
- - 0
126
- version: "0"
215
+ - 1
216
+ - 3
217
+ - 1
218
+ version: 1.3.1
127
219
  requirements: []
128
220
 
129
221
  rubyforge_project: omniauth_china
130
222
  rubygems_version: 1.3.7
131
223
  signing_key:
132
224
  specification_version: 3
133
- summary: "OmniAuth extention: omniauth for china"
225
+ summary: "OmniAuth extension: omniauth for china"
134
226
  test_files:
135
227
  - spec/omniauth_china/strategies/douban_spec.rb
136
228
  - spec/omniauth_china/strategies/t163_spec.rb
229
+ - spec/omniauth_china/strategies/tqq_spec.rb
137
230
  - spec/omniauth_china/strategies/tsina_spec.rb
138
231
  - spec/omniauth_china/strategies/tsohu_spec.rb
139
232
  - spec/spec_helper.rb