omniauth-younility 1.0.0
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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +71 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/omniauth-younility.rb +2 -0
- data/lib/omniauth/strategies/younility.rb +58 -0
- data/lib/omniauth/younility.rb +7 -0
- data/lib/omniauth/younility/version.rb +5 -0
- data/omniauth-younility.gemspec +30 -0
- metadata +174 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f1875a15e2cfd83546e48fcd310d1d093f7b26ec
|
4
|
+
data.tar.gz: ed6422e64f511565faee04f3a2be3879242e5af9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0edf3120eece410f41586a8dfb26682aa07e7ceb5f48007ab5dba23ecda55d575e07b3f0e8d1c8367b5445a535fa0edf6eb2c9146e85abe0c255f7b48730c7f7
|
7
|
+
data.tar.gz: e9dcd1a0e4d77253b1aff7cf9a64c501f5992700d442f0d078faa535bc86de67f6f4285cd95ff694aab3d9dc08646efd4ed6874d3b80dfcfcc3374dd54ecaccf
|
data/.gitignore
ADDED
data/.rspec
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) 2015 Younility Inc.
|
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,71 @@
|
|
1
|
+
# Omniauth Younility Strategy
|
2
|
+
|
3
|
+
Version 1.0.0
|
4
|
+
|
5
|
+
OAuth2 strategy for [`omniauth`](http://rubygems.org/gems/omniauth) and
|
6
|
+
[Younility](http://www.younility.com/).
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```sh
|
13
|
+
gem 'omniauth-younility'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
```sh
|
19
|
+
$ bundle
|
20
|
+
```
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
```sh
|
25
|
+
$ gem install omniauth-younility
|
26
|
+
```
|
27
|
+
|
28
|
+
## Demo
|
29
|
+
|
30
|
+
You can see a demo of usage at [our heroku site](https://signatron.herokuapp.com)
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
The API is currently only in private beta. Usage instructions to follow.
|
35
|
+
|
36
|
+
For now, see the source of the demo app at [our github site](https://github.com/YounilityInc/signature_generator).
|
37
|
+
|
38
|
+
### Ruby
|
39
|
+
|
40
|
+
For use in a _Sinatra_ or _Ruby on Rails_ application:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
# config/initializers/omniauth.rb
|
44
|
+
module OmniAuth
|
45
|
+
module Strategies
|
46
|
+
# tell OmniAuth to load the Younility strategy
|
47
|
+
autoload :Younility, 'omniauth/strategies/younility'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
52
|
+
provider :younility, ENV['YOUNILITY_APP_ID'], ENV['YOUNILITY_APP_SECRET']
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
## Development
|
57
|
+
|
58
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
59
|
+
|
60
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
61
|
+
|
62
|
+
## Contributing
|
63
|
+
1. Fork it ( http://github.com/YounilityInc/omniauth-younility/fork )
|
64
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
65
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
66
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
67
|
+
5. Create new Pull Request
|
68
|
+
|
69
|
+
## License
|
70
|
+
|
71
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "omniauth/younility"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
# OmniAuth OAuth2 Strategy for Younility API
|
6
|
+
class Younility < OmniAuth::Strategies::OAuth2
|
7
|
+
option :name, "younility"
|
8
|
+
|
9
|
+
option :client_options, {
|
10
|
+
site: 'https://app.younility.com',
|
11
|
+
authorize_url: '/api/oauth/authorize',
|
12
|
+
token_url: '/api/oauth/token'
|
13
|
+
}
|
14
|
+
|
15
|
+
def authorize_params
|
16
|
+
super.tap do |params|
|
17
|
+
params[:response_type] = 'code'
|
18
|
+
params[:client_id] = client.id
|
19
|
+
params[:redirect_uri] ||= callback_url
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def request_phase
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
uid do
|
28
|
+
raw_info['id']
|
29
|
+
end
|
30
|
+
|
31
|
+
info do
|
32
|
+
{
|
33
|
+
'id' => raw_info['id'],
|
34
|
+
'name' => raw_info['name'],
|
35
|
+
'email' => raw_info['email'],
|
36
|
+
'default_organization_id' => raw_info['default_organization_id'],
|
37
|
+
'default_role' => raw_info['default_role']
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def raw_info
|
42
|
+
@raw_info ||= access_token.get('/api/v0/whoami').parsed
|
43
|
+
end
|
44
|
+
|
45
|
+
def build_access_token
|
46
|
+
token_params = {
|
47
|
+
code: request.params['code'],
|
48
|
+
redirect_uri: callback_url,
|
49
|
+
client_id: client.id,
|
50
|
+
client_secret: client.secret,
|
51
|
+
grant_type: 'authorization_code'
|
52
|
+
}
|
53
|
+
client.get_token token_params
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth/younility/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'omniauth-younility'
|
8
|
+
spec.version = Omniauth::Younility::VERSION
|
9
|
+
spec.authors = ['Chris Cameron', 'Paul Robertson', 'Farrukh Abdulkadyrov']
|
10
|
+
spec.email = ['unchris@outlook.com', 't.paulrobertson@gmail.com', 'farrukhabdul@gmail.com']
|
11
|
+
spec.summary = %q{ OmniAuth strategy for Younility. }
|
12
|
+
spec.description = %q{ OmniAuth strategy for Younility. }
|
13
|
+
spec.homepage = 'https://github.com/YounilityInc/omniauth-younility'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = 'exe'
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec'
|
24
|
+
spec.add_development_dependency 'rack-test'
|
25
|
+
spec.add_development_dependency 'simplecov'
|
26
|
+
spec.add_development_dependency 'webmock'
|
27
|
+
|
28
|
+
spec.add_dependency 'omniauth', '~> 1.0'
|
29
|
+
spec.add_dependency 'omniauth-oauth2', '~> 1.3.1'
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,174 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-younility
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Cameron
|
8
|
+
- Paul Robertson
|
9
|
+
- Farrukh Abdulkadyrov
|
10
|
+
autorequire:
|
11
|
+
bindir: exe
|
12
|
+
cert_chain: []
|
13
|
+
date: 2015-12-10 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bundler
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.10'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '1.10'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: rake
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '10.0'
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '10.0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rspec
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: rack-test
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: simplecov
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: webmock
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: omniauth
|
101
|
+
requirement: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - "~>"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '1.0'
|
106
|
+
type: :runtime
|
107
|
+
prerelease: false
|
108
|
+
version_requirements: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '1.0'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: omniauth-oauth2
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 1.3.1
|
120
|
+
type: :runtime
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - "~>"
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 1.3.1
|
127
|
+
description: " OmniAuth strategy for Younility. "
|
128
|
+
email:
|
129
|
+
- unchris@outlook.com
|
130
|
+
- t.paulrobertson@gmail.com
|
131
|
+
- farrukhabdul@gmail.com
|
132
|
+
executables: []
|
133
|
+
extensions: []
|
134
|
+
extra_rdoc_files: []
|
135
|
+
files:
|
136
|
+
- ".gitignore"
|
137
|
+
- ".rspec"
|
138
|
+
- ".travis.yml"
|
139
|
+
- Gemfile
|
140
|
+
- LICENSE.txt
|
141
|
+
- README.md
|
142
|
+
- Rakefile
|
143
|
+
- bin/console
|
144
|
+
- bin/setup
|
145
|
+
- lib/omniauth-younility.rb
|
146
|
+
- lib/omniauth/strategies/younility.rb
|
147
|
+
- lib/omniauth/younility.rb
|
148
|
+
- lib/omniauth/younility/version.rb
|
149
|
+
- omniauth-younility.gemspec
|
150
|
+
homepage: https://github.com/YounilityInc/omniauth-younility
|
151
|
+
licenses:
|
152
|
+
- MIT
|
153
|
+
metadata: {}
|
154
|
+
post_install_message:
|
155
|
+
rdoc_options: []
|
156
|
+
require_paths:
|
157
|
+
- lib
|
158
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
requirements: []
|
169
|
+
rubyforge_project:
|
170
|
+
rubygems_version: 2.4.8
|
171
|
+
signing_key:
|
172
|
+
specification_version: 4
|
173
|
+
summary: OmniAuth strategy for Younility.
|
174
|
+
test_files: []
|