omniauth-orcid 0.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.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # OmniAuth ORCID
2
+
3
+ ORCID OAuth 2.0 Strategy for OmniAuth 1.0.
4
+
5
+ Originally created for the [ORCID example client application in Rails](https://github.com/gthorisson/ORCID-example-client-app-rails), then turned into a gem.
6
+
7
+
8
+ ...stuff coming, patience plz....
9
+
10
+
11
+ ## More information
12
+
13
+ ORCID Developer Portal - http://dev.orcid.org
14
+
15
+
16
+
17
+
18
+ ## License
19
+
20
+ The MIT License (OSI approved, see more at http://www.opensource.org/licenses/mit-license.php)
21
+
22
+ =============================================================================
23
+
24
+ Copyright (C) 2012 by Gudmundur A. Thorisson
25
+
26
+ Permission is hereby granted, free of charge, to any person obtaining a copy
27
+ of this software and associated documentation files (the "Software"), to deal
28
+ in the Software without restriction, including without limitation the rights
29
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
30
+ copies of the Software, and to permit persons to whom the Software is
31
+ furnished to do so, subject to the following conditions:
32
+
33
+ The above copyright notice and this permission notice shall be included in
34
+ all copies or substantial portions of the Software.
35
+
36
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
42
+ THE SOFTWARE.
43
+
44
+ =============================================================================
45
+
46
+ ![Open Source Initiative Approved License](http://www.opensource.org/trademarks/opensource/web/opensource-110x95.jpg)
@@ -0,0 +1,2 @@
1
+ require "omniauth-orcid/version"
2
+ require 'omniauth/strategies/orcid'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module ORCID
3
+ VERSION = "0.1"
4
+ end
5
+ end
@@ -0,0 +1,40 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ # OmniAuth strategy for connecting to the ORCID contributor ID service via the OAuth 2.0 protocol
4
+
5
+ module OmniAuth
6
+ module Strategies
7
+ class ORCID < OmniAuth::Strategies::OAuth2
8
+
9
+ DEFAULT_SCOPE = '/orcid-bio/read-protected'
10
+
11
+ option :client_options, {
12
+ :site => 'http://api.devsandbox.orcid.org',
13
+ :authorize_url => 'http://devsandbox.orcid.org/oauth/authorize',
14
+ :token_url => 'http://api.devsandbox.orcid.org/oauth/token',
15
+ :scope => '/orcid-profile/read-protected',
16
+ :response_type => 'code',
17
+ :mode => :header
18
+ }
19
+
20
+
21
+ # Pull out unique ID for the user in the external system
22
+ uid { access_token.params["orcid"] }
23
+
24
+ info do{} end
25
+
26
+ # Customize the parameters passed to the OAuth provider in the authorization phase
27
+ def authorize_params
28
+
29
+ # Trick shamelessly borrowed from the omniauth-facebook gem!
30
+ super.tap do |params|
31
+ %w[scope].each { |v| params[v.to_sym] = request.params[v] if request.params[v] }
32
+ params[:scope] ||= DEFAULT_SCOPE # ensure that we're always request *some* default scope
33
+ Rails.logger.debug "Customizing authz params: " + params.inspect
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ OmniAuth.config.add_camelization 'orcid', 'ORCID'
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-orcid
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Gudmundur A. Thorisson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: omniauth-oauth2
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.1'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.1'
46
+ description: ORCID OAuth 2.0 Strategy for OmniAuth 1.0
47
+ email: gthorisson@gmail.com
48
+ executables: []
49
+ extensions: []
50
+ extra_rdoc_files: []
51
+ files:
52
+ - lib/omniauth/strategies/orcid.rb
53
+ - lib/omniauth-orcid/version.rb
54
+ - lib/omniauth-orcid.rb
55
+ - README.md
56
+ homepage: http://rubygems.org/gems/omniauth-orcid
57
+ licenses: []
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 1.8.23
77
+ signing_key:
78
+ specification_version: 3
79
+ summary: ORCID OAuth 2.0 Strategy for OmniAuth 1.0
80
+ test_files: []