omniauth-orcid 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 014bcb635ac59370ed0b52f945e480a1c75bd988
4
- data.tar.gz: fe2189f5a092ab669a538ede6333bbefde5cfa3c
3
+ metadata.gz: 3433775b793b7860d91b4f8e809575e1610b64ae
4
+ data.tar.gz: e8c54ca4b1ebadb64710036159bb1dccaf1a6d00
5
5
  SHA512:
6
- metadata.gz: b5dcfd8cb87c495a48bcf8f06e53b3d1a31b8e27647bfcce75366771170be3c64f7da535d6888736c6d3629b29be73641d7963b5dd5aac764ed2de8777fc94c2
7
- data.tar.gz: d3009264a0febb2fe630c109059657d38fa1d99070364c62acb936e39be77751447d985119afe356dbf63db04cfb7a8ed361899b59fc013a9269b62e9d80f99c
6
+ metadata.gz: 7a34431d0520bb7b8a7e51b26034a2eb3fc775f951ce83047c91819a075a33a7ab725f5370d0141a17d5da1f5e1f37f49e60bfefb71de2ef245352ab951be839
7
+ data.tar.gz: 5c0f534a4f938b699fe1164159770e53d340396d86e50342f6873d202784bb4d5179df4e4cc5f264097b2d0391101ed309b15db4ad6440212d9654bfe977eeb0
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ config.yml
6
+ coverage
7
+ InstalledFiles
8
+ lib/bundler/man
9
+ pkg
10
+ rdoc
11
+ spec/reports
12
+ test/tmp
13
+ test/version_tmp
14
+ tmp
15
+ Gemfile.lock
16
+
17
+ # YARD artifacts
18
+ .yardoc
19
+ _yardoc
20
+ doc/
data/README.md CHANGED
@@ -46,7 +46,7 @@ There are three ways to register a client application and obtain client app cred
46
46
 
47
47
  * for non-members (the default): Register your client application in the `Developer Tools` section of your ORCID profile. Use `https://pub.orcid.org` as `site URL`
48
48
  * for members (production): Register your client application [here](http://orcid.org/content/register-client-application). Use https://api.orcid.org as `site URL`
49
- * for development (sandbox): Register your client application [here](https://orcid.org/content/register-client-application-sandbox). Use https://sandbox.orcid.org as `site URL`
49
+ * for development (sandbox): Register your client application [here](https://orcid.org/content/register-client-application-sandbox). Use https://api.sandbox.orcid.org as `site URL`
50
50
 
51
51
  OmniAuth takes care of the OAuth external-authentication handshake or "dance". All that the gem does is grab the identifier and tokens at the end of the dance and stick it into the OmniAuth hash which is subsequently accessible to your app via `request.env['omniauth.auth']` (see [AuthHashSchema](https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema)). The hash looks something like this:
52
52
 
@@ -163,14 +163,14 @@ use OmniAuth::Builder do
163
163
  scope: '/orcid-profile/read-limited'
164
164
  },
165
165
  client_options: {
166
- site: ENV['ORCID_URL'],
166
+ site: ENV['API_ORCID_URL'],
167
167
  authorize_url: "#{ENV['ORCID_URL']}/oauth/authorize",
168
- token_url: "#{ENV['ORCID_URL']}/oauth/token",
168
+ token_url: "#{ENV['API_ORCID_URL']}/oauth/token",
169
169
  }
170
170
  end
171
171
 
172
172
  ```
173
- Where `ENV['ORCID_CLIENT_ID']` and `ENV['ORCID_CLIENT_SECRET']` are provided by ORCID when registering the application, and `ENV['ORCID_URL']` depends on the API you are using (see above).
173
+ Where `ENV['ORCID_CLIENT_ID']` and `ENV['ORCID_CLIENT_SECRET']` are provided by ORCID when registering the application, and `ENV['API_ORCID_URL']` depends on the API you are using (see above).
174
174
 
175
175
 
176
176
  ## More information
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Orcid
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
@@ -6,33 +6,33 @@ module OmniAuth
6
6
  module Strategies
7
7
  class ORCID < OmniAuth::Strategies::OAuth2
8
8
 
9
- DEFAULT_SCOPE = '/authenticate'
9
+ option :name, "orcid"
10
10
 
11
11
  option :client_options, {
12
- :site => 'http://api.orcid.org',
13
- :authorize_url => 'http://orcid.org/oauth/authorize',
14
- :token_url => 'https://pub.orcid.org/oauth/token',
15
- :scope => '/authenticate',
16
- :response_type => 'code',
17
- :mode => :header
12
+ site: 'https://pub.orcid.org',
13
+ authorize_url: 'https://orcid.org/oauth/authorize',
14
+ scope: '/authenticate'
18
15
  }
19
16
 
20
- # Pull out unique ID for the user in the external system
21
- uid { access_token.params["orcid"] }
17
+ def request_phase
18
+ options[:show_login] ||= "false"
19
+ super
20
+ end
21
+
22
+ uid { raw_info["orcid"] }
22
23
 
23
24
  info do
24
- { name: access_token.params["name"],
25
- email: access_token.params["email"] }
25
+ { name: raw_info["name"] }
26
26
  end
27
27
 
28
- # Customize the parameters passed to the OAuth provider in the authorization phase
29
- def authorize_params
28
+ extra do
29
+ {
30
+ 'raw_info' => raw_info
31
+ }
32
+ end
30
33
 
31
- # Trick shamelessly borrowed from the omniauth-facebook gem!
32
- super.tap do |params|
33
- %w[scope].each { |v| params[v.to_sym] = request.params[v] if request.params[v] }
34
- params[:scope] ||= DEFAULT_SCOPE # ensure that we're always request *some* default scope
35
- end
34
+ def raw_info
35
+ @raw_info ||= access_token.params
36
36
  end
37
37
  end
38
38
  end
@@ -5,20 +5,20 @@ Gem::Specification.new do |s|
5
5
  s.authors = ["Gudmundur A. Thorisson", "Martin Fenner"]
6
6
  s.email = ["gthorisson@gmail.com", "martin.fenner@datacite.org"]
7
7
  s.name = "omniauth-orcid"
8
- s.homepage = %q{https://github.com/datacite/omniauth-orcid}
9
- s.summary = %q{ORCID OAuth 2.0 Strategy for OmniAuth 1.0}
8
+ s.homepage = "https://github.com/datacite/omniauth-orcid"
9
+ s.summary = "ORCID OAuth 2.0 Strategy for OmniAuth 1.0"
10
10
  s.date = Date.today
11
- s.description = %q{Enables third-party client apps to connect to the ORCID API and access/update protected profile data }
12
- s.files = Dir["{lib}/**/*.rb", "bin/*", "LICENSE.txt", "*.md", "Rakefile", "Gemfile", "demo.rb", "omniauth-orcid.gemspec"]
11
+ s.description = "Enables third-party client apps to connect to the ORCID API and access/update protected profile data"
13
12
  s.require_paths = ["lib"]
14
13
  s.version = OmniAuth::Orcid::VERSION
15
14
  s.extra_rdoc_files = ["README.md"]
16
15
  s.license = 'MIT'
17
16
 
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.require_paths = ["lib"]
18
20
 
19
21
  # Declary dependencies here, rather than in the Gemfile
20
- s.add_dependency 'omniauth', '~> 1.0'
21
22
  s.add_dependency 'omniauth-oauth2', '~> 1.1'
22
-
23
+ s.add_development_dependency 'bundler', '~> 1.0'
23
24
  end
24
-
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: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gudmundur A. Thorisson
@@ -9,38 +9,38 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-27 00:00:00.000000000 Z
12
+ date: 2015-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: omniauth
15
+ name: omniauth-oauth2
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.0'
20
+ version: '1.1'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.0'
27
+ version: '1.1'
28
28
  - !ruby/object:Gem::Dependency
29
- name: omniauth-oauth2
29
+ name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '1.1'
35
- type: :runtime
34
+ version: '1.0'
35
+ type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '1.1'
42
- description: 'Enables third-party client apps to connect to the ORCID API and access/update
43
- protected profile data '
41
+ version: '1.0'
42
+ description: Enables third-party client apps to connect to the ORCID API and access/update
43
+ protected profile data
44
44
  email:
45
45
  - gthorisson@gmail.com
46
46
  - martin.fenner@datacite.org
@@ -49,6 +49,7 @@ extensions: []
49
49
  extra_rdoc_files:
50
50
  - README.md
51
51
  files:
52
+ - ".gitignore"
52
53
  - CHANGELOG.md
53
54
  - Gemfile
54
55
  - LICENSE.txt
@@ -80,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
81
  version: '0'
81
82
  requirements: []
82
83
  rubyforge_project:
83
- rubygems_version: 2.4.5
84
+ rubygems_version: 2.4.5.1
84
85
  signing_key:
85
86
  specification_version: 4
86
87
  summary: ORCID OAuth 2.0 Strategy for OmniAuth 1.0