omniauth-draugiem 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -2
- data/README.md +2 -2
- data/lib/omniauth-draugiem/version.rb +1 -1
- data/lib/omniauth/strategies/draugiem.rb +2 -2
- data/omniauth-draugiem.gemspec +2 -1
- data/spec/omniauth/strategies/draugiem_spec.rb +9 -9
- data/spec/spec_helper.rb +4 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d02ed02020c52e2ea3b3c72d4da019fb376e80c
|
4
|
+
data.tar.gz: e1cd42b6b53304e7f1bef69868e36271d16ef85f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd4dece0b7d1639a749038b7ee97268483ceba61ce7bfce56c6270d23c027e571fc11c35cc98c3b9a5b43415089a4e395a43d67efc3f8004bd222c8b35ae2d8f
|
7
|
+
data.tar.gz: 7a3a07f2e66543e63df8c7af00ea0cf9bae66a55d33066208b6d67d3925be9c54c5dfb05c2ce07ccb596586fcb1236fff28c7337fca3c96c4a39f02d8efeb08f
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# OmniAuth Draugiem
|
2
2
|
|
3
|
-
[![Continuous Integration status](https://secure.travis-ci.org/mak-it/omniauth-draugiem.
|
3
|
+
[![Continuous Integration status](https://secure.travis-ci.org/mak-it/omniauth-draugiem.svg)](http://travis-ci.org/mak-it/omniauth-draugiem)
|
4
4
|
|
5
5
|
OmniAuth strategy for authenticating to draugiem.lv
|
6
6
|
|
@@ -35,12 +35,12 @@ module OmniAuth
|
|
35
35
|
:hash => Digest::MD5.hexdigest("#{options.api_key}#{callback_url}")
|
36
36
|
}
|
37
37
|
query_string = params.collect{ |key,value| "#{key}=#{Rack::Utils.escape(value)}" }.join('&')
|
38
|
-
redirect "
|
38
|
+
redirect "https://api.draugiem.lv/authorize/?#{query_string}"
|
39
39
|
end
|
40
40
|
|
41
41
|
def callback_phase
|
42
42
|
if request.params['dr_auth_status'] == 'ok' && request.params['dr_auth_code']
|
43
|
-
response = RestClient.get('
|
43
|
+
response = RestClient.get('https://api.draugiem.lv/json/', { :params => draugiem_authorize_params(request.params['dr_auth_code']) })
|
44
44
|
auth = MultiJson.decode(response.to_s)
|
45
45
|
unless auth['error']
|
46
46
|
@auth_data = auth
|
data/omniauth-draugiem.gemspec
CHANGED
@@ -20,10 +20,11 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
s.add_runtime_dependency "omniauth", "~> 1.0"
|
22
22
|
s.add_runtime_dependency "rest-client", "~> 1.6"
|
23
|
+
s.add_runtime_dependency "multi_json", "~> 1.0"
|
23
24
|
|
24
25
|
s.add_development_dependency "bundler", "~> 1.5"
|
25
26
|
s.add_development_dependency "rake"
|
26
|
-
s.add_development_dependency "rspec"
|
27
|
+
s.add_development_dependency "rspec", "~> 3.0"
|
27
28
|
s.add_development_dependency "simplecov"
|
28
29
|
s.add_development_dependency "rack-test"
|
29
30
|
s.add_development_dependency 'webmock'
|
@@ -9,19 +9,19 @@ describe 'OmniAuth::Strategies::Draugiem', :type => :strategy do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'should initialize with api key and app id' do
|
12
|
-
|
12
|
+
expect { OmniAuth::Strategies::Draugiem.new({},'123','abc') }.to_not raise_error
|
13
13
|
end
|
14
14
|
|
15
15
|
describe '/auth/draugiem' do
|
16
16
|
|
17
17
|
it 'should redirect to api.draugiem.lv' do
|
18
18
|
get '/auth/draugiem'
|
19
|
-
last_response.
|
20
|
-
last_response.headers['Location'].
|
19
|
+
expect(last_response).to be_redirect
|
20
|
+
expect(last_response.headers['Location']).to match %r{https://api\.draugiem\.lv/authorize/}
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should gather user data after success authorization' do
|
24
|
-
stub_request(:get, "
|
24
|
+
stub_request(:get, "https://api.draugiem.lv/json/?action=authorize&app=abc&code=123456").
|
25
25
|
to_return(:body => MultiJson.encode({
|
26
26
|
'apikey'=>"123456789",
|
27
27
|
'uid'=>"100",
|
@@ -35,17 +35,17 @@ describe 'OmniAuth::Strategies::Draugiem', :type => :strategy do
|
|
35
35
|
'place'=>"Durbe",
|
36
36
|
'age'=>"false",
|
37
37
|
'adult'=>"1",
|
38
|
-
'img'=>"
|
38
|
+
'img'=>"https://4.bp.blogspot.com/_ZmXOoYjxXog/Sg2jby1RFSI/AAAAAAAAE_Q/1LpfjimAz50/s400/JohnnyBravo3.gif",
|
39
39
|
'sex'=>"M"
|
40
40
|
}
|
41
41
|
}
|
42
42
|
}))
|
43
43
|
get '/auth/draugiem/callback?dr_auth_status=ok&dr_auth_code=123456'
|
44
44
|
|
45
|
-
last_request.env['omniauth.auth']['credentials']['apikey'].
|
46
|
-
last_request.env['omniauth.auth']['info']['location'].
|
47
|
-
last_request.env['omniauth.auth']['info']['age'].
|
48
|
-
last_request.env['omniauth.auth']['info']['adult'].
|
45
|
+
expect(last_request.env['omniauth.auth']['credentials']['apikey']).to eq "123456789"
|
46
|
+
expect(last_request.env['omniauth.auth']['info']['location']).to eq "Durbe"
|
47
|
+
expect(last_request.env['omniauth.auth']['info']['age']).to be nil
|
48
|
+
expect(last_request.env['omniauth.auth']['info']['adult']).to be true
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-draugiem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edgars Beigarts
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-03-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth
|
@@ -39,6 +39,20 @@ dependencies:
|
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.6'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: multi_json
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.0'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.0'
|
42
56
|
- !ruby/object:Gem::Dependency
|
43
57
|
name: bundler
|
44
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,16 +85,16 @@ dependencies:
|
|
71
85
|
name: rspec
|
72
86
|
requirement: !ruby/object:Gem::Requirement
|
73
87
|
requirements:
|
74
|
-
- - "
|
88
|
+
- - "~>"
|
75
89
|
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
90
|
+
version: '3.0'
|
77
91
|
type: :development
|
78
92
|
prerelease: false
|
79
93
|
version_requirements: !ruby/object:Gem::Requirement
|
80
94
|
requirements:
|
81
|
-
- - "
|
95
|
+
- - "~>"
|
82
96
|
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
97
|
+
version: '3.0'
|
84
98
|
- !ruby/object:Gem::Dependency
|
85
99
|
name: simplecov
|
86
100
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
177
|
version: '0'
|
164
178
|
requirements: []
|
165
179
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.
|
180
|
+
rubygems_version: 2.6.8
|
167
181
|
signing_key:
|
168
182
|
specification_version: 4
|
169
183
|
summary: Draugiem.lv authentication strategy for OmniAuth
|