omniauth-orcid 1.2 → 1.2.1
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.
- checksums.yaml +8 -8
- data/README.md +2 -0
- data/lib/omniauth/orcid/version.rb +1 -1
- data/lib/omniauth/strategies/orcid.rb +13 -14
- data/omniauth-orcid.gemspec +1 -0
- data/spec/omniauth/strategies/orcid_spec.rb +20 -8
- data/spec/spec_helper.rb +3 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTUxMmYyMzNkMWQ5MDY2NWY4MzlkZWY3Yjk2ZDljNDA3ZmU5YTQzZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODFjZjAxOTA3MjFlMWY5ZDVkOGE2Y2MxMmNhOGI2NDg3YzZmN2VkMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDE4YWFmMWVjODJiNTUwMDYzZGJjNDRjZDY5MmQ0NDU3OGZmM2ExYjYxMWEx
|
10
|
+
MTU5MjA1ZWQ5MmZhZTViZjQyYTE0NGU4MzAyYjUyODAxYTI1NzhlNGRiZjZk
|
11
|
+
OTYzNGYwNzAxNDczYzYwYzhhYzM1MWUxZWYxYTcyMTVlOWFhYTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWFhYjZhNTQxNDNhMDcwYTE1OWQ4Zjc5OWJjZGZmZjdkZDdmNDkyNTE3YTNm
|
14
|
+
MjEzMjMxZDlhYjM5NWMzZDU1NGFhZDY4NWRkZDQxZTRmOWJhYzllZDA5ZjUw
|
15
|
+
NWQ0MWNmYzg0YTY3MjMyMzRkYmM2ZjlhNDNkNThkNzIxOGIzMTI=
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/omniauth-orcid)
|
4
4
|
[](https://travis-ci.org/datacite/omniauth-orcid)
|
5
|
+
[](https://codeclimate.com/github/datacite/omniauth-orcid/coverage)
|
6
|
+
[](https://codeclimate.com/github/datacite/omniauth-orcid)
|
5
7
|
[](https://zenodo.org/badge/latestdoi/15088/datacite/omniauth-orcid)
|
6
8
|
|
7
9
|
ORCID OAuth 2.0 Strategy for the [OmniAuth Ruby authentication framework](http://www.omniauth.org).
|
@@ -20,7 +20,8 @@ module OmniAuth
|
|
20
20
|
:given_names,
|
21
21
|
:family_names,
|
22
22
|
:email,
|
23
|
-
:orcid
|
23
|
+
:orcid,
|
24
|
+
:scope]
|
24
25
|
|
25
26
|
args [:client_id, :client_secret]
|
26
27
|
|
@@ -31,20 +32,23 @@ module OmniAuth
|
|
31
32
|
@options.client_options.api_base_url = api_base_url
|
32
33
|
@options.client_options.authorize_url = authorize_url
|
33
34
|
@options.client_options.token_url = token_url
|
34
|
-
@options.client_options.scope = scope
|
35
35
|
end
|
36
36
|
|
37
37
|
# available options at https://members.orcid.org/api/get-oauthauthorize
|
38
38
|
def authorize_params
|
39
39
|
super.tap do |params|
|
40
|
-
|
41
|
-
|
40
|
+
%w[scope redirect_uri show_login lang given_names family_names email orcid].each do |v|
|
41
|
+
if request.params[v]
|
42
|
+
params[v.to_sym] = request.params[v]
|
43
|
+
end
|
42
44
|
end
|
43
45
|
|
44
46
|
# show login form and not registration form by default
|
45
47
|
params[:show_login] = 'true' if params[:show_login].nil?
|
46
48
|
|
47
49
|
session['omniauth.state'] = params[:state] if params['state']
|
50
|
+
|
51
|
+
params[:scope] ||= scope
|
48
52
|
end
|
49
53
|
end
|
50
54
|
|
@@ -63,10 +67,10 @@ module OmniAuth
|
|
63
67
|
|
64
68
|
def site
|
65
69
|
case namespace
|
66
|
-
when 'sandbox' then '
|
67
|
-
when 'production' then '
|
68
|
-
when 'public_sandbox' then '
|
69
|
-
when 'public' then '
|
70
|
+
when 'sandbox' then 'https://api.sandbox.orcid.org'
|
71
|
+
when 'production' then 'https://api.orcid.org'
|
72
|
+
when 'public_sandbox' then 'https://pub.sandbox.orcid.org'
|
73
|
+
when 'public' then 'https://pub.orcid.org'
|
70
74
|
end
|
71
75
|
end
|
72
76
|
|
@@ -87,12 +91,7 @@ module OmniAuth
|
|
87
91
|
end
|
88
92
|
|
89
93
|
def token_url
|
90
|
-
|
91
|
-
when 'sandbox' then 'https://api.sandbox.orcid.org/oauth/token'
|
92
|
-
when 'production' then 'https://api.orcid.org/oauth/token'
|
93
|
-
when 'public_sandbox' then 'https://pub.sandbox.orcid.org/oauth/token'
|
94
|
-
when 'public' then 'https://pub.orcid.org/oauth/token'
|
95
|
-
end
|
94
|
+
site + '/oauth/token'
|
96
95
|
end
|
97
96
|
|
98
97
|
def scope
|
data/omniauth-orcid.gemspec
CHANGED
@@ -24,4 +24,5 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_development_dependency 'rspec', '~> 3.4'
|
25
25
|
s.add_development_dependency 'rack-test', '~> 0.6.3'
|
26
26
|
s.add_development_dependency 'webmock', '~> 1.22', '>= 1.22.3'
|
27
|
+
s.add_development_dependency 'codeclimate-test-reporter'
|
27
28
|
end
|
@@ -31,11 +31,11 @@ describe OmniAuth::Strategies::ORCID do
|
|
31
31
|
|
32
32
|
describe "default" do
|
33
33
|
it 'should have correct site' do
|
34
|
-
expect(subject.options.client_options.site).to eq('
|
34
|
+
expect(subject.options.client_options.site).to eq('https://pub.orcid.org')
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should have correct scope' do
|
38
|
-
expect(subject.
|
38
|
+
expect(subject.authorize_params['scope']).to eq('/authenticate')
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'should have correct token url' do
|
@@ -57,11 +57,11 @@ describe OmniAuth::Strategies::ORCID do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'should have correct site' do
|
60
|
-
expect(subject.options.client_options.site).to eq("
|
60
|
+
expect(subject.options.client_options.site).to eq("https://pub.sandbox.orcid.org")
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'should have correct scope' do
|
64
|
-
expect(subject.
|
64
|
+
expect(subject.authorize_params['scope']).to eq("/authenticate")
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'should have correct token url' do
|
@@ -83,11 +83,11 @@ describe OmniAuth::Strategies::ORCID do
|
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'should have correct site' do
|
86
|
-
expect(subject.options.client_options.site).to eq('
|
86
|
+
expect(subject.options.client_options.site).to eq('https://api.orcid.org')
|
87
87
|
end
|
88
88
|
|
89
89
|
it 'should have correct scope' do
|
90
|
-
expect(subject.
|
90
|
+
expect(subject.authorize_params['scope']).to eq('/read-limited /activities/update /orcid-bio/update')
|
91
91
|
end
|
92
92
|
|
93
93
|
it 'should have correct token url' do
|
@@ -101,11 +101,11 @@ describe OmniAuth::Strategies::ORCID do
|
|
101
101
|
end
|
102
102
|
|
103
103
|
it 'should have correct site' do
|
104
|
-
expect(subject.options.client_options.site).to eq("
|
104
|
+
expect(subject.options.client_options.site).to eq("https://api.sandbox.orcid.org")
|
105
105
|
end
|
106
106
|
|
107
107
|
it 'should have correct scope' do
|
108
|
-
expect(subject.
|
108
|
+
expect(subject.authorize_params['scope']).to eq('/read-limited /activities/update /orcid-bio/update')
|
109
109
|
end
|
110
110
|
|
111
111
|
it 'should have correct token url' do
|
@@ -162,6 +162,18 @@ describe OmniAuth::Strategies::ORCID do
|
|
162
162
|
expect(subject.authorize_params["email"]).to eq("josiah@brown.edu")
|
163
163
|
end
|
164
164
|
end
|
165
|
+
|
166
|
+
describe "scope" do
|
167
|
+
it 'should default to nil' do
|
168
|
+
@options = {}
|
169
|
+
expect(subject.authorize_params['scope']).to eq("/authenticate")
|
170
|
+
end
|
171
|
+
|
172
|
+
it 'should set the scope parameter if present' do
|
173
|
+
@options = { scope: '/read-limited' }
|
174
|
+
expect(subject.authorize_params['scope']).to eq("/read-limited")
|
175
|
+
end
|
176
|
+
end
|
165
177
|
end
|
166
178
|
|
167
179
|
describe 'extra' do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-orcid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gudmundur A. Thorisson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-09-
|
12
|
+
date: 2016-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth-oauth2
|
@@ -87,6 +87,20 @@ dependencies:
|
|
87
87
|
- - ! '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 1.22.3
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: codeclimate-test-reporter
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
type: :development
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
90
104
|
description: Enables third-party client apps to connect to the ORCID API and access/update
|
91
105
|
protected profile data
|
92
106
|
email:
|