omniauth-geekpark 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -7
- data/Gemfile.lock +61 -65
- data/Guardfile +28 -6
- data/Rakefile +3 -5
- data/bin/console +7 -0
- data/bin/setup +8 -0
- data/lib/omniauth-geekpark.rb +4 -1
- data/lib/omniauth-geekpark/version.rb +1 -1
- data/lib/omniauth/strategies/geekpark.rb +9 -11
- data/lib/omniauth/strategies/wechat.rb +75 -0
- data/lib/patch/omniauth-oauth2.rb +20 -0
- data/omniauth-geekpark.gemspec +24 -23
- metadata +37 -37
- data/spec/omniauth/strategies/geekpark_spec.rb +0 -29
- data/spec/spec_helper.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3e056f9fad34b96205bc0db48dbebbc38859207
|
4
|
+
data.tar.gz: c55a0157df2f979353b6c9c2631b2b216b401bf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 196d15878dbf0c0aea49cd3c6c11e2c3487ca477d415e09744f915287c964ac32498566c0a7ae29e7736eecd40a9be02e98a14fa764d6cb8e928204813773ea9
|
7
|
+
data.tar.gz: 5ea857a323b3248af357fcc94a9420ea373c7025197e4bc8c78960e990a53291205f63d4e70dce2945092c3bb94258b9c672443a08fa0982e7b85c061fbe3c21
|
data/Gemfile
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
source '
|
2
|
-
|
1
|
+
source 'https://gems.ruby-china.org'
|
3
2
|
# Specify your gem's dependencies in omniauth-geekpark.gemspec
|
4
3
|
gemspec
|
5
4
|
|
6
5
|
group :development, :test do
|
7
|
-
gem 'guard'
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
gem '
|
6
|
+
gem 'guard-rspec', require: false
|
7
|
+
end
|
8
|
+
|
9
|
+
group :test do
|
10
|
+
gem 'codeclimate-test-reporter', require: false
|
12
11
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,118 +1,114 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omniauth-geekpark (0.0
|
4
|
+
omniauth-geekpark (0.2.0)
|
5
5
|
omniauth (~> 1.0)
|
6
|
-
omniauth-oauth2 (
|
6
|
+
omniauth-oauth2 (= 1.3.1)
|
7
7
|
|
8
8
|
GEM
|
9
|
-
remote:
|
9
|
+
remote: https://gems.ruby-china.org/
|
10
10
|
specs:
|
11
|
-
addressable (2.
|
12
|
-
|
13
|
-
|
14
|
-
coderay (1.1.
|
15
|
-
crack (0.4.
|
11
|
+
addressable (2.4.0)
|
12
|
+
codeclimate-test-reporter (0.5.0)
|
13
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
14
|
+
coderay (1.1.1)
|
15
|
+
crack (0.4.3)
|
16
16
|
safe_yaml (~> 1.0.0)
|
17
17
|
diff-lcs (1.2.5)
|
18
18
|
docile (1.1.5)
|
19
|
-
faraday (0.9.
|
19
|
+
faraday (0.9.2)
|
20
20
|
multipart-post (>= 1.2, < 3)
|
21
|
-
ffi (1.9.
|
21
|
+
ffi (1.9.10)
|
22
22
|
formatador (0.2.5)
|
23
|
-
|
24
|
-
guard (2.12.5)
|
23
|
+
guard (2.13.0)
|
25
24
|
formatador (>= 0.2.4)
|
26
|
-
listen (
|
25
|
+
listen (>= 2.7, <= 4.0)
|
27
26
|
lumberjack (~> 1.0)
|
28
27
|
nenv (~> 0.1)
|
29
28
|
notiffany (~> 0.0)
|
30
29
|
pry (>= 0.9.12)
|
31
30
|
shellany (~> 0.0)
|
32
31
|
thor (>= 0.18.1)
|
33
|
-
guard-bundler (2.1.0)
|
34
|
-
bundler (~> 1.0)
|
35
|
-
guard (~> 2.2)
|
36
|
-
guard-compat (~> 1.1)
|
37
32
|
guard-compat (1.2.1)
|
38
|
-
guard-rspec (4.5
|
33
|
+
guard-rspec (4.6.5)
|
39
34
|
guard (~> 2.1)
|
40
35
|
guard-compat (~> 1.1)
|
41
36
|
rspec (>= 2.99.0, < 4.0)
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
37
|
+
hashdiff (0.3.0)
|
38
|
+
hashie (3.4.3)
|
39
|
+
json (1.8.3)
|
40
|
+
jwt (1.5.1)
|
41
|
+
listen (3.0.6)
|
47
42
|
rb-fsevent (>= 0.9.3)
|
48
|
-
rb-inotify (>= 0.9)
|
49
|
-
lumberjack (1.0.
|
43
|
+
rb-inotify (>= 0.9.7)
|
44
|
+
lumberjack (1.0.10)
|
50
45
|
method_source (0.8.2)
|
51
|
-
multi_json (1.11.
|
46
|
+
multi_json (1.11.2)
|
52
47
|
multi_xml (0.5.5)
|
53
48
|
multipart-post (2.0.0)
|
54
|
-
nenv (0.
|
55
|
-
notiffany (0.0.
|
49
|
+
nenv (0.3.0)
|
50
|
+
notiffany (0.0.8)
|
56
51
|
nenv (~> 0.1)
|
57
52
|
shellany (~> 0.0)
|
58
|
-
oauth2 (1.
|
53
|
+
oauth2 (1.1.0)
|
59
54
|
faraday (>= 0.8, < 0.10)
|
60
|
-
jwt (~> 1.0)
|
55
|
+
jwt (~> 1.0, < 1.5.2)
|
61
56
|
multi_json (~> 1.3)
|
62
57
|
multi_xml (~> 0.5)
|
63
|
-
rack (
|
64
|
-
omniauth (1.
|
58
|
+
rack (>= 1.2, < 3)
|
59
|
+
omniauth (1.3.1)
|
65
60
|
hashie (>= 1.2, < 4)
|
66
|
-
rack (
|
67
|
-
omniauth-oauth2 (1.
|
68
|
-
faraday (>= 0.8, < 0.10)
|
69
|
-
multi_json (~> 1.3)
|
61
|
+
rack (>= 1.0, < 3)
|
62
|
+
omniauth-oauth2 (1.3.1)
|
70
63
|
oauth2 (~> 1.0)
|
71
64
|
omniauth (~> 1.2)
|
72
|
-
pry (0.10.
|
65
|
+
pry (0.10.3)
|
73
66
|
coderay (~> 1.1.0)
|
74
67
|
method_source (~> 0.8.1)
|
75
68
|
slop (~> 3.4)
|
76
|
-
rack (1.6.
|
77
|
-
|
78
|
-
|
79
|
-
rb-
|
80
|
-
rb-inotify (0.9.5)
|
69
|
+
rack (1.6.4)
|
70
|
+
rake (10.5.0)
|
71
|
+
rb-fsevent (0.9.7)
|
72
|
+
rb-inotify (0.9.7)
|
81
73
|
ffi (>= 0.5.0)
|
82
|
-
rspec (
|
83
|
-
rspec-core (~>
|
84
|
-
rspec-expectations (~>
|
85
|
-
rspec-mocks (~>
|
86
|
-
rspec-core (
|
87
|
-
|
88
|
-
|
89
|
-
|
74
|
+
rspec (3.4.0)
|
75
|
+
rspec-core (~> 3.4.0)
|
76
|
+
rspec-expectations (~> 3.4.0)
|
77
|
+
rspec-mocks (~> 3.4.0)
|
78
|
+
rspec-core (3.4.4)
|
79
|
+
rspec-support (~> 3.4.0)
|
80
|
+
rspec-expectations (3.4.0)
|
81
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
82
|
+
rspec-support (~> 3.4.0)
|
83
|
+
rspec-mocks (3.4.1)
|
84
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
85
|
+
rspec-support (~> 3.4.0)
|
86
|
+
rspec-support (3.4.1)
|
90
87
|
safe_yaml (1.0.4)
|
91
88
|
shellany (0.0.1)
|
92
|
-
simplecov (0.
|
89
|
+
simplecov (0.11.2)
|
93
90
|
docile (~> 1.1.0)
|
94
|
-
|
95
|
-
simplecov-html (~> 0.
|
96
|
-
simplecov-html (0.
|
91
|
+
json (~> 1.8)
|
92
|
+
simplecov-html (~> 0.10.0)
|
93
|
+
simplecov-html (0.10.0)
|
97
94
|
slop (3.6.0)
|
98
95
|
thor (0.19.1)
|
99
|
-
|
100
|
-
hitimes
|
101
|
-
webmock (1.21.0)
|
96
|
+
webmock (1.24.2)
|
102
97
|
addressable (>= 2.3.6)
|
103
98
|
crack (>= 0.3.2)
|
99
|
+
hashdiff
|
104
100
|
|
105
101
|
PLATFORMS
|
106
102
|
ruby
|
107
103
|
|
108
104
|
DEPENDENCIES
|
109
|
-
|
110
|
-
|
111
|
-
guard-bundler
|
105
|
+
bundler (~> 1.11)
|
106
|
+
codeclimate-test-reporter
|
112
107
|
guard-rspec
|
113
108
|
omniauth-geekpark!
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
109
|
+
rake (~> 10.0)
|
110
|
+
rspec (~> 3.0)
|
111
|
+
webmock (~> 1.24, >= 1.24.2)
|
112
|
+
|
113
|
+
BUNDLED WITH
|
114
|
+
1.11.2
|
data/Guardfile
CHANGED
@@ -1,10 +1,32 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
|
3
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
4
|
+
# rspec may be run, below are examples of the most common uses.
|
5
|
+
# * bundler: 'bundle exec rspec'
|
6
|
+
# * bundler binstubs: 'bin/rspec'
|
7
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
8
|
+
# installed the spring binstubs per the docs)
|
9
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
10
|
+
# * 'just' rspec: 'rspec'
|
11
|
+
|
12
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
13
|
+
require "guard/rspec/dsl"
|
14
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
15
|
+
|
16
|
+
# Feel free to open issues for suggestions and improvements
|
17
|
+
|
18
|
+
# RSpec files
|
19
|
+
rspec = dsl.rspec
|
20
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
21
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
22
|
+
watch(rspec.spec_files)
|
23
|
+
|
24
|
+
# Ruby files
|
25
|
+
ruby = dsl.ruby
|
26
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
27
|
+
|
28
|
+
# Gem files
|
2
29
|
watch(%r{^spec/.+_spec\.rb$})
|
3
30
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
4
31
|
watch('spec/spec_helper.rb') { "spec" }
|
5
32
|
end
|
6
|
-
|
7
|
-
guard 'bundler' do
|
8
|
-
watch('Gemfile')
|
9
|
-
watch('omniauth-geekpark.gemspec')
|
10
|
-
end
|
data/Rakefile
CHANGED
data/bin/console
ADDED
data/bin/setup
ADDED
data/lib/omniauth-geekpark.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'omniauth-oauth2'
|
2
|
-
|
3
1
|
module OmniAuth
|
4
2
|
module Strategies
|
5
3
|
class GeekPark < OmniAuth::Strategies::OAuth2
|
@@ -13,15 +11,15 @@ module OmniAuth
|
|
13
11
|
|
14
12
|
info do
|
15
13
|
{
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
14
|
+
username: raw_info['username'],
|
15
|
+
realname: raw_info['realname'],
|
16
|
+
email: raw_info['email'],
|
17
|
+
company: raw_info['company'],
|
18
|
+
position: raw_info['position'],
|
19
|
+
mobile: raw_info['mobile'],
|
20
|
+
avatar: raw_info['avatar'],
|
21
|
+
bio: raw_info['bio'],
|
22
|
+
mygeekpark_open_id: raw_info['mygeekpark_open_id'],
|
25
23
|
}
|
26
24
|
end
|
27
25
|
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module OmniAuth
|
2
|
+
module Strategies
|
3
|
+
class WeChat < OmniAuth::Strategies::OAuth2
|
4
|
+
option :client_options, {
|
5
|
+
site: 'https://api.weixin.qq.com',
|
6
|
+
authorize_url: 'https://open.weixin.qq.com/connect/qrconnect',
|
7
|
+
token_url: 'https://api.weixin.qq.com/sns/oauth2/access_token',
|
8
|
+
}
|
9
|
+
|
10
|
+
uid { raw_info['unionid'] }
|
11
|
+
|
12
|
+
info do
|
13
|
+
{
|
14
|
+
nickname: raw_info['nickname'],
|
15
|
+
city: raw_info['city'],
|
16
|
+
avatar: raw_info['headimgurl']
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def raw_info
|
21
|
+
@raw_info ||= begin
|
22
|
+
response = access_token.get(
|
23
|
+
'/sns/userinfo',
|
24
|
+
{ params: { access_token: access_token.token,
|
25
|
+
openid: access_token['openid'],
|
26
|
+
lang: 'zh-CN' },
|
27
|
+
parse: :json }
|
28
|
+
).parsed
|
29
|
+
log :debug, response
|
30
|
+
response
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def request_phase
|
35
|
+
redirect client.authorize_url(authorize_params)+'#wechat_redirect'
|
36
|
+
end
|
37
|
+
|
38
|
+
def authorize_params
|
39
|
+
options.authorize_params[:state] = SecureRandom.hex(24)
|
40
|
+
params = options.authorize_params.merge({
|
41
|
+
appid: options.client_id,
|
42
|
+
redirect_uri: callback_url,
|
43
|
+
response_type: 'code',
|
44
|
+
scope: request.params['scope'] || 'snsapi_login',
|
45
|
+
})
|
46
|
+
if OmniAuth.config.test_mode
|
47
|
+
@env ||= {}
|
48
|
+
@env["rack.session"] ||= {}
|
49
|
+
end
|
50
|
+
session["omniauth.state"] = params[:state]
|
51
|
+
params
|
52
|
+
end
|
53
|
+
|
54
|
+
def token_params
|
55
|
+
{ appid: options.client_id, secret: options.client_secret }
|
56
|
+
end
|
57
|
+
|
58
|
+
protected
|
59
|
+
|
60
|
+
def build_access_token
|
61
|
+
request_params = {
|
62
|
+
appid: options.client_id,
|
63
|
+
secret: options.client_secret,
|
64
|
+
code: request.params['code'],
|
65
|
+
grant_type: 'authorization_code',
|
66
|
+
parse: :json
|
67
|
+
}
|
68
|
+
client.get_token(request_params, {mode: :query})
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
OmniAuth.config.add_camelization('wechat', 'WeChat')
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class OmniAuth::Strategies::OAuth2
|
2
|
+
def callback_phase # rubocop:disable AbcSize, CyclomaticComplexity, MethodLength, PerceivedComplexity
|
3
|
+
error = request.params["error_reason"] || request.params["error"]
|
4
|
+
if error
|
5
|
+
fail!(error, CallbackError.new(request.params["error"], request.params["error_description"] || request.params["error_reason"], request.params["error_uri"]))
|
6
|
+
elsif !options.provider_ignores_state && (request.params["state"].to_s.empty? || request.params["state"] != session.delete("omniauth.state"))
|
7
|
+
fail!(:csrf_detected, CallbackError.new(:csrf_detected, "CSRF detected"))
|
8
|
+
else
|
9
|
+
self.access_token = build_access_token
|
10
|
+
fail!(:token_expired, CallbackError.new(:token_expired,'Token has expired, refresh and try again.')) if access_token.expired?
|
11
|
+
super
|
12
|
+
end
|
13
|
+
rescue ::OAuth2::Error, CallbackError => e
|
14
|
+
fail!(:invalid_credentials, e)
|
15
|
+
rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e
|
16
|
+
fail!(:timeout, e)
|
17
|
+
rescue ::SocketError => e
|
18
|
+
fail!(:failed_to_connect, e)
|
19
|
+
end
|
20
|
+
end
|
data/omniauth-geekpark.gemspec
CHANGED
@@ -1,27 +1,28 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth-geekpark/version'
|
3
5
|
|
4
|
-
Gem::Specification.new do |
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
gem.homepage = "https://github.com/GeekPark/omniauth-geekpark"
|
10
|
-
gem.license = "MIT"
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'omniauth-geekpark'
|
8
|
+
spec.version = OmniAuth::GeekPark::VERSION
|
9
|
+
spec.authors = %w(HaoYunfei Gavin)
|
10
|
+
spec.email = ["haoyunfei@geekpark.net"]
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
gem.require_paths = ["lib"]
|
17
|
-
gem.version = OmniAuth::GeekPark::VERSION
|
12
|
+
spec.summary = %q{ OmniAuth strategies for GeekPark. Includes geekpark, weibo and wechat. }
|
13
|
+
spec.description = %q{ Official OmniAuth strategies for GeekPark. }
|
14
|
+
spec.homepage = "https://github.com/GeekPark/omniauth-geekpark"
|
15
|
+
spec.license = "MIT"
|
18
16
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency 'omniauth', '~> 1.0'
|
23
|
+
spec.add_dependency 'omniauth-oauth2', '1.3.1'
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
spec.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.2'
|
27
28
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-geekpark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HaoYunfei
|
8
8
|
- Gavin
|
9
9
|
autorequire:
|
10
|
-
bindir:
|
10
|
+
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-04-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
@@ -29,81 +29,81 @@ dependencies:
|
|
29
29
|
name: omniauth-oauth2
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 1.1.1
|
35
|
-
- - "<"
|
32
|
+
- - '='
|
36
33
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
34
|
+
version: 1.3.1
|
38
35
|
type: :runtime
|
39
36
|
prerelease: false
|
40
37
|
version_requirements: !ruby/object:Gem::Requirement
|
41
38
|
requirements:
|
42
|
-
- -
|
39
|
+
- - '='
|
43
40
|
- !ruby/object:Gem::Version
|
44
|
-
version: 1.
|
45
|
-
- - "<"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '2.0'
|
41
|
+
version: 1.3.1
|
48
42
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
43
|
+
name: bundler
|
50
44
|
requirement: !ruby/object:Gem::Requirement
|
51
45
|
requirements:
|
52
46
|
- - "~>"
|
53
47
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
48
|
+
version: '1.11'
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
52
|
requirements:
|
59
53
|
- - "~>"
|
60
54
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
55
|
+
version: '1.11'
|
62
56
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
57
|
+
name: rake
|
64
58
|
requirement: !ruby/object:Gem::Requirement
|
65
59
|
requirements:
|
66
|
-
- - "
|
60
|
+
- - "~>"
|
67
61
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
62
|
+
version: '10.0'
|
69
63
|
type: :development
|
70
64
|
prerelease: false
|
71
65
|
version_requirements: !ruby/object:Gem::Requirement
|
72
66
|
requirements:
|
73
|
-
- - "
|
67
|
+
- - "~>"
|
74
68
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
69
|
+
version: '10.0'
|
76
70
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
71
|
+
name: rspec
|
78
72
|
requirement: !ruby/object:Gem::Requirement
|
79
73
|
requirements:
|
80
|
-
- - "
|
74
|
+
- - "~>"
|
81
75
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
76
|
+
version: '3.0'
|
83
77
|
type: :development
|
84
78
|
prerelease: false
|
85
79
|
version_requirements: !ruby/object:Gem::Requirement
|
86
80
|
requirements:
|
87
|
-
- - "
|
81
|
+
- - "~>"
|
88
82
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
83
|
+
version: '3.0'
|
90
84
|
- !ruby/object:Gem::Dependency
|
91
85
|
name: webmock
|
92
86
|
requirement: !ruby/object:Gem::Requirement
|
93
87
|
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '1.24'
|
94
91
|
- - ">="
|
95
92
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
93
|
+
version: 1.24.2
|
97
94
|
type: :development
|
98
95
|
prerelease: false
|
99
96
|
version_requirements: !ruby/object:Gem::Requirement
|
100
97
|
requirements:
|
98
|
+
- - "~>"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '1.24'
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
104
|
-
description: Official OmniAuth
|
103
|
+
version: 1.24.2
|
104
|
+
description: " Official OmniAuth strategies for GeekPark. "
|
105
105
|
email:
|
106
|
-
-
|
106
|
+
- haoyunfei@geekpark.net
|
107
107
|
executables: []
|
108
108
|
extensions: []
|
109
109
|
extra_rdoc_files: []
|
@@ -114,12 +114,14 @@ files:
|
|
114
114
|
- Guardfile
|
115
115
|
- README.md
|
116
116
|
- Rakefile
|
117
|
+
- bin/console
|
118
|
+
- bin/setup
|
117
119
|
- lib/omniauth-geekpark.rb
|
118
120
|
- lib/omniauth-geekpark/version.rb
|
119
121
|
- lib/omniauth/strategies/geekpark.rb
|
122
|
+
- lib/omniauth/strategies/wechat.rb
|
123
|
+
- lib/patch/omniauth-oauth2.rb
|
120
124
|
- omniauth-geekpark.gemspec
|
121
|
-
- spec/omniauth/strategies/geekpark_spec.rb
|
122
|
-
- spec/spec_helper.rb
|
123
125
|
homepage: https://github.com/GeekPark/omniauth-geekpark
|
124
126
|
licenses:
|
125
127
|
- MIT
|
@@ -140,10 +142,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
142
|
version: '0'
|
141
143
|
requirements: []
|
142
144
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
145
|
+
rubygems_version: 2.6.3
|
144
146
|
signing_key:
|
145
147
|
specification_version: 4
|
146
|
-
summary:
|
147
|
-
test_files:
|
148
|
-
- spec/omniauth/strategies/geekpark_spec.rb
|
149
|
-
- spec/spec_helper.rb
|
148
|
+
summary: OmniAuth strategies for GeekPark. Includes geekpark, weibo and wechat.
|
149
|
+
test_files: []
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe OmniAuth::Strategies::GeekPark do
|
4
|
-
let(:access_token) { double('AccessToken', options: {}) }
|
5
|
-
let(:parsed_response) { double('ParsedResponse') }
|
6
|
-
let(:response) { double('Response', parsed: parsed_response) }
|
7
|
-
|
8
|
-
subject do
|
9
|
-
OmniAuth::Strategies::GeekPark.new({})
|
10
|
-
end
|
11
|
-
|
12
|
-
before(:each) do
|
13
|
-
subject.stub(:access_token).and_return(access_token)
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'client options' do
|
17
|
-
it 'should have correct site' do
|
18
|
-
subject.options.client_options.site.should eq('http://www.geekpark.net')
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should have correct authorize url' do
|
22
|
-
subject.options.client_options.authorize_url.should eq('http://www.geekpark.net/oauth2/authorize')
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should have corrent token url' do
|
26
|
-
subject.options.client_options.token_url.should eq('http://www.geekpark.net/oauth2/token')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
$:.unshift File.expand_path('..', __FILE__)
|
2
|
-
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
-
require 'simplecov'
|
4
|
-
SimpleCov.start
|
5
|
-
require 'rspec'
|
6
|
-
require 'rack/test'
|
7
|
-
require 'webmock/rspec'
|
8
|
-
require 'omniauth'
|
9
|
-
require 'omniauth-geekpark'
|
10
|
-
|
11
|
-
RSpec.configure do |config|
|
12
|
-
config.include WebMock::API
|
13
|
-
config.include Rack::Test::Methods
|
14
|
-
config.extend OmniAuth::Test::StrategyMacros, type: :strategy
|
15
|
-
end
|
16
|
-
|