omniauth-qzone 1.0.0.rc → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/omniauth/strategies/qzone.rb +38 -32
- data/lib/omniauth-qzone/version.rb +1 -1
- metadata +60 -92
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9be8823a03d8c2f034980ba9de4ad7cc7bb229f7
|
4
|
+
data.tar.gz: f10e82480400436c11fd7cc26aa1aa1bc6359d48
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: efbea2bc66d6e15f7509e716bf4c93f61d963ce2347e9e343ec62c006d8d935446f3c2e16eea257f2d86bd5261bdfea0e78623de3a59daa78592a27fea80034b
|
7
|
+
data.tar.gz: 7d73e3888133661abb734abe144f36ae92ba65f4b14bc38bc5e6503dc7c0f3d52d04c8a28ff87caf9dcae95161ff7c05dd37f774d68bab2a474b05b96bb02d8b
|
@@ -1,31 +1,35 @@
|
|
1
|
-
require 'omniauth-
|
1
|
+
require 'omniauth-oauth2'
|
2
2
|
require 'multi_json'
|
3
3
|
module OmniAuth
|
4
4
|
module Strategies
|
5
5
|
#taken from https://github.com/he9qi/omniauth_china/blob/55dac2d2a657d20711459f89dfeb802a8f06c81e/lib/omniauth_china/strategies/qzone.rb
|
6
|
-
class Qzone < OmniAuth::Strategies::
|
6
|
+
class Qzone < OmniAuth::Strategies::OAuth2
|
7
7
|
option :name, 'qzone'
|
8
|
-
option :sign_in, true
|
9
|
-
def initialize(*args)
|
10
|
-
super
|
11
|
-
options.client_options = {
|
12
|
-
:access_token_path => '/oauth/qzoneoauth_access_token',
|
13
|
-
:authorize_path => '/oauth/qzoneoauth_authorize',
|
14
|
-
:realm => 'OmniAuth',
|
15
|
-
:request_token_path => '/oauth/qzoneoauth_request_token',
|
16
|
-
:site => 'http://openapi.qzone.qq.com',
|
17
|
-
:scheme => :query_string,
|
18
|
-
:http_method => :get
|
19
|
-
}
|
20
|
-
end
|
21
8
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
9
|
+
option :client_options, {
|
10
|
+
:site => 'https://graph.qq.com/oauth2.0/',
|
11
|
+
:authorize_url => '/oauth2.0/authorize',
|
12
|
+
:token_url => "/oauth2.0/token"
|
13
|
+
}
|
14
|
+
|
15
|
+
option :token_params, {
|
16
|
+
:state => 'foobar',
|
17
|
+
:parse => :query
|
18
|
+
}
|
19
|
+
|
20
|
+
|
21
|
+
uid {
|
22
|
+
@uid ||= begin
|
23
|
+
access_token.options[:mode] = :query
|
24
|
+
access_token.options[:param_name] = :access_token
|
25
|
+
# Response Example: "callback( {\"client_id\":\"11111\",\"openid\":\"000000FFFF\"} );\n"
|
26
|
+
response = access_token.get('/oauth2.0/me')
|
27
|
+
#TODO handle error case
|
28
|
+
matched = response.body.match(/"openid":"(?<openid>\w+)"/)
|
29
|
+
matched[:openid]
|
30
|
+
end
|
31
|
+
|
32
|
+
}
|
29
33
|
|
30
34
|
info do
|
31
35
|
{
|
@@ -42,17 +46,19 @@ module OmniAuth
|
|
42
46
|
extra do
|
43
47
|
{ :raw_info => raw_info }
|
44
48
|
end
|
45
|
-
|
46
49
|
def raw_info
|
47
|
-
@raw_info ||=
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
@raw_info ||= begin
|
51
|
+
#TODO handle error case
|
52
|
+
#TODO make info request url configurable
|
53
|
+
|
54
|
+
client.request(:get, "https://graph.qq.com/user/get_user_info", :params => {
|
55
|
+
:format => :json,
|
56
|
+
:openid => uid,
|
57
|
+
:oauth_consumer_key => options[:client_id],
|
58
|
+
:access_token => access_token.token
|
59
|
+
}, :parse => :json).parsed
|
60
|
+
end
|
55
61
|
end
|
56
62
|
end
|
57
63
|
end
|
58
|
-
end
|
64
|
+
end
|
metadata
CHANGED
@@ -1,120 +1,88 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-qzone
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease: 6
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
- rc
|
11
|
-
version: 1.0.0.rc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
12
5
|
platform: ruby
|
13
|
-
authors:
|
6
|
+
authors:
|
14
7
|
- zhang ming
|
15
8
|
autorequire:
|
16
9
|
bindir: bin
|
17
10
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2013-09-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
22
14
|
name: omniauth
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 15424049
|
30
|
-
segments:
|
31
|
-
- 1
|
32
|
-
- 0
|
33
|
-
- 0
|
34
|
-
- rc
|
35
|
-
- 2
|
36
|
-
version: 1.0.0.rc2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
37
20
|
type: :runtime
|
38
|
-
version_requirements: *id001
|
39
|
-
- !ruby/object:Gem::Dependency
|
40
|
-
name: omniauth-oauth
|
41
21
|
prerelease: false
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
version: 1.0.0.rc2
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: omniauth-oauth
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
55
34
|
type: :runtime
|
56
|
-
version_requirements: *id002
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: multi_json
|
59
35
|
prerelease: false
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: multi_json
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
69
48
|
type: :runtime
|
70
|
-
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
71
55
|
description: an omniauth strategy for qzone
|
72
|
-
email:
|
73
|
-
-
|
56
|
+
email:
|
57
|
+
- zhangming1021@gmail.com
|
74
58
|
executables: []
|
75
|
-
|
76
59
|
extensions: []
|
77
|
-
|
78
60
|
extra_rdoc_files: []
|
79
|
-
|
80
|
-
files:
|
61
|
+
files:
|
81
62
|
- lib/omniauth-qzone/version.rb
|
82
63
|
- lib/omniauth/strategies/qzone.rb
|
83
64
|
- lib/omniauth-qzone.rb
|
84
|
-
homepage:
|
65
|
+
homepage: ''
|
85
66
|
licenses: []
|
86
|
-
|
67
|
+
metadata: {}
|
87
68
|
post_install_message:
|
88
69
|
rdoc_options: []
|
89
|
-
|
90
|
-
require_paths:
|
70
|
+
require_paths:
|
91
71
|
- lib
|
92
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
none: false
|
103
|
-
requirements:
|
104
|
-
- - ">"
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
hash: 25
|
107
|
-
segments:
|
108
|
-
- 1
|
109
|
-
- 3
|
110
|
-
- 1
|
111
|
-
version: 1.3.1
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
112
82
|
requirements: []
|
113
|
-
|
114
83
|
rubyforge_project: omniauth-qzone
|
115
|
-
rubygems_version:
|
84
|
+
rubygems_version: 2.0.3
|
116
85
|
signing_key:
|
117
|
-
specification_version:
|
86
|
+
specification_version: 4
|
118
87
|
summary: an omniauth strategy for qzone
|
119
88
|
test_files: []
|
120
|
-
|