omniauth-carvoyant 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +89 -0
- data/Rakefile +10 -0
- data/lib/omniauth-carvoyant.rb +2 -0
- data/lib/omniauth-carvoyant/version.rb +5 -0
- data/lib/omniauth/strategies/carvoyant.rb +41 -0
- data/omniauth-carvoyant.gemspec +24 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f98a420ff9a50a6ed6be592acf93f4632e0bebba
|
4
|
+
data.tar.gz: e0cb077935d2bfbc1279219c8dd10bf303ad35dd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 90531f9d32846377619a910d7d92faa0ed1b4cd7b50438c0b130869498b7c434e1f502457b4609ec7bd7593b31dae6b95ff037e66512f79563c73051dd88ddf1
|
7
|
+
data.tar.gz: 2ff64667a947f871b4078aec03842342240e955d53a6222ed9caa785b1a82f3c96635faf49945c056ea13483dac140664269c345d157d4c3c1e0159931b63490
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Farrukh Abdulkadyrov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# OmniAuth Carvoyant OAuth2 Strategy
|
2
|
+
|
3
|
+
Strategy to authenticate with Carvoyant via OAuth2 in OmniAuth.
|
4
|
+
|
5
|
+
Register for you developer account at: https://developer.carvoyant.com/member/register Note the Client ID and Client Secret.
|
6
|
+
|
7
|
+
For more details read Carvoyant docs: https://developer.carvoyant.com/page
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add to your `Gemfile`:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'omniauth-carvoyant'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Here's an example for adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
27
|
+
provider :carvoyant, ENV["CARVOYANT_CLIENT_ID"], ENV["CARVOYANT_CLIENT_SECRET"]
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
You can now access the OmniAuth Carvoyant OAuth2 URL: `/auth/carvoyant`
|
32
|
+
|
33
|
+
## Configuration
|
34
|
+
|
35
|
+
You can configure several options, which you pass in to the `provider` method via a hash:
|
36
|
+
|
37
|
+
* `callback_path`: Custom call back uri. Default is `/auth/carvoyant/callback`
|
38
|
+
* `name`: Custom strategy name. Default is `carvoyant` but it can be changed to any value, for example `carvoyant-api`. The OmniAuth URL will thus change to `/auth/carvoyant-api` and the `provider` key in the auth hash will then return `carvoyant-api`.
|
39
|
+
|
40
|
+
Here is an example of custom configuration with strategy name and callback uri changed:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
44
|
+
provider :carvoyant, ENV["CARVOYANT_CLIENT_ID"], ENV["CARVOYANT_CLIENT_SECRET"],
|
45
|
+
{
|
46
|
+
:name => 'carvoyant1',
|
47
|
+
:callback_path => 'carvoyant/callback'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
## Auth Hash
|
53
|
+
|
54
|
+
Here's an example of an authentication hash available in the callback by accessing `request.env["omniauth.auth"]`:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
{
|
58
|
+
:provider => "carvoyant",
|
59
|
+
:uid => "123456789",
|
60
|
+
:info => {
|
61
|
+
:name => "John Doe",
|
62
|
+
:email => "john@company_name.com",
|
63
|
+
:first_name => "John",
|
64
|
+
:last_name => "Doe",
|
65
|
+
:username => "john.doe"
|
66
|
+
},
|
67
|
+
:credentials => {
|
68
|
+
:token => "token",
|
69
|
+
:refresh_token => "another_token",
|
70
|
+
:expires_at => 1354920555,
|
71
|
+
:expires => true
|
72
|
+
}
|
73
|
+
}
|
74
|
+
```
|
75
|
+
|
76
|
+
## Contributing
|
77
|
+
|
78
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/faragorn/omniauth-carvoyant.
|
79
|
+
|
80
|
+
|
81
|
+
## License
|
82
|
+
|
83
|
+
Copyright (c) 2015 by Farrukh Abdulkadyrov
|
84
|
+
|
85
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
86
|
+
|
87
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
88
|
+
|
89
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class Carvoyant < OmniAuth::Strategies::OAuth2
|
6
|
+
|
7
|
+
SITE_PREFIX = '/v1/api'
|
8
|
+
|
9
|
+
option :name, 'carvoyant'
|
10
|
+
|
11
|
+
option :client_options, {
|
12
|
+
site: 'https://api.carvoyant.com/v1/api',
|
13
|
+
authorize_url: 'https://auth.carvoyant.com/oauth/authorize',
|
14
|
+
token_url: 'https://api.carvoyant.com/oauth/token'
|
15
|
+
}
|
16
|
+
|
17
|
+
uid do
|
18
|
+
raw_info['id']
|
19
|
+
end
|
20
|
+
|
21
|
+
info do
|
22
|
+
{
|
23
|
+
'name' => "#{raw_info['firstName']} #{raw_info['lastName']}",
|
24
|
+
'first_name' => raw_info['firstName'],
|
25
|
+
'last_name' => raw_info['lastName'],
|
26
|
+
'email' => raw_info['email'],
|
27
|
+
'username' => raw_info['username']
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def callback_url
|
33
|
+
full_host + script_name + callback_path
|
34
|
+
end
|
35
|
+
|
36
|
+
def raw_info
|
37
|
+
@raw_info ||= access_token.get("#{SITE_PREFIX}/account").parsed['account'][0]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
require File.expand_path('../lib/omniauth-carvoyant/version', __FILE__)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'omniauth-carvoyant'
|
7
|
+
spec.version = OmniAuth::Carvoyant::VERSION
|
8
|
+
spec.authors = ['Farrukh Abdulkadyrov']
|
9
|
+
spec.email = ['farrukhabdul@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'Carvoyant OAuth2 strategy for OmniAuth'
|
12
|
+
spec.homepage = 'https://github.com/faragorn/omniauth-carvoyant'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
17
|
+
spec.require_paths = ['lib']
|
18
|
+
|
19
|
+
spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.2'
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'minitest'
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-carvoyant
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Farrukh Abdulkadyrov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth-oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- farrukhabdul@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".travis.yml"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- lib/omniauth-carvoyant.rb
|
83
|
+
- lib/omniauth-carvoyant/version.rb
|
84
|
+
- lib/omniauth/strategies/carvoyant.rb
|
85
|
+
- omniauth-carvoyant.gemspec
|
86
|
+
homepage: https://github.com/faragorn/omniauth-carvoyant
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.4.6
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Carvoyant OAuth2 strategy for OmniAuth
|
110
|
+
test_files: []
|