omniauth-kindful-user 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 +6 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -0
- data/README.md +54 -0
- data/Rakefile +7 -0
- data/lib/omniauth/strategies/kindful_user.rb +29 -0
- data/lib/omniauth-kindful-user/version.rb +5 -0
- data/lib/omniauth-kindful-user.rb +2 -0
- data/omniauth-kindful-user.gemspec +37 -0
- data/spec/omniauth/strategies/kindful_user_spec.rb +29 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/support/shared_examples.rb +40 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3a0b822268d4a10c6c7cae406ad384b8a102021f
|
4
|
+
data.tar.gz: d6a804a8ebee99415e72eb4dba2d8017a2587d92
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7bc95222f7034dd9a06e3a3c68d90dc89d537650e1230df98266338b1179cf33886e79bf0e5a7bf3e15af091bd969022cecbde968128c0fb20e8b5a0218f9c3e
|
7
|
+
data.tar.gz: 9f6e9acc1283fc0e70d2ca8095082d1d3c74f7b302e58237b5f7f3204ba451c3e83e32c9f31e7aaba8bb289e5a4af801ff4ab559356b13c88e8c00472464fec5
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# OmniAuth KindfulUser
|
2
|
+
|
3
|
+
KindfulUser Oauth2 provides an easy way to provide secure sites for donors to log into. This login can be restrict access based on custom fields set on the donor's profile.
|
4
|
+
|
5
|
+
If your looking to integrate with the non profit organization itself to insert client and transaction data into their account, the you should use the KindfulAdmin Oauth2 gem
|
6
|
+
|
7
|
+
Additional documentation on getting your access keys generated can be found here https://developer.kindful.com/docs/oauth-user-view
|
8
|
+
## Usecases
|
9
|
+
|
10
|
+
* Provide access to a website to active members
|
11
|
+
* Provide access to a website only to board members
|
12
|
+
|
13
|
+
## Installing
|
14
|
+
|
15
|
+
Add to your `Gemfile`:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'omniauth-kindful-user'
|
19
|
+
```
|
20
|
+
|
21
|
+
Then `bundle install`.
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
`OmniAuth::Strategies::KindfulUser` is simply a Rack middleware.
|
26
|
+
Read the OmniAuth 2.0 docs for detailed instructions:
|
27
|
+
<https://github.com/intridea/omniauth>.
|
28
|
+
|
29
|
+
Here's a quick example, adding the middleware to a Rails app
|
30
|
+
in `config/initializers/omniauth.rb` and getting a token with
|
31
|
+
scope permissions for full user info, send and request transactions:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
35
|
+
provider :kindful_user, ENV['KINDFUL_KEY'], ENV['KINDFUL_SECRET'],
|
36
|
+
client_options: {site: "https://example-client.kindful.com}
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
the endpoint /oauth2/api/v1/details.json
|
41
|
+
is called and provides the below information
|
42
|
+
|
43
|
+
|
44
|
+
```json
|
45
|
+
{
|
46
|
+
"id": 123,
|
47
|
+
"name": "John Doe",
|
48
|
+
"email": "john@test.com"
|
49
|
+
}
|
50
|
+
```
|
51
|
+
|
52
|
+
|
53
|
+
Additional fields can be configured to provide first_name, last_name, custom fields, and membership details. talk to support@kindful.com for more information on getting those setup.
|
54
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class KindfulUser < OmniAuth::Strategies::OAuth2
|
7
|
+
option :name, 'kindful_user'
|
8
|
+
option :client_options, {
|
9
|
+
# the site subdomain is specific to the kindful client your working with.
|
10
|
+
:site => 'https://client-subdomain.kindful.com',
|
11
|
+
:authorize_url => '/oauth2/authenticate',
|
12
|
+
:token_url => '/oauth2/token'
|
13
|
+
}
|
14
|
+
|
15
|
+
uid { raw_info['id'] }
|
16
|
+
|
17
|
+
def raw_info
|
18
|
+
@raw_info ||= access_token.get('/oauth2/api/v1/details.json').parsed
|
19
|
+
end
|
20
|
+
|
21
|
+
# clear query string on redirect_url so as to conform to 3.1.2 of oauth2 spec
|
22
|
+
def query_string
|
23
|
+
""
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "omniauth-kindful-user/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "omniauth-kindful-user"
|
7
|
+
s.version = Omniauth::KindfulUser::VERSION
|
8
|
+
s.authors = ["pbrumm"]
|
9
|
+
s.email = ["pete@kindful.com"]
|
10
|
+
s.homepage = "https://github.com/kindful/omniauth-kindful-user"
|
11
|
+
s.summary = %q{OmniAuth strategy for Kindful User.}
|
12
|
+
s.description = %q{OmniAuth strategy for Kindful User.}
|
13
|
+
s.license = 'MIT'
|
14
|
+
post_install_string =<<END
|
15
|
+
Remember to specify
|
16
|
+
client_options: {site: "https://example-client.kindful.com}
|
17
|
+
with the correct subdomain for the client your working with
|
18
|
+
END
|
19
|
+
s.post_install_message = post_install_string
|
20
|
+
|
21
|
+
s.rubyforge_project = "omniauth-kindful-user"
|
22
|
+
|
23
|
+
s.files = `git ls-files`.split("\n")
|
24
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
26
|
+
s.require_paths = ["lib"]
|
27
|
+
|
28
|
+
s.add_dependency 'omniauth', '~> 1.2'
|
29
|
+
s.add_dependency 'omniauth-oauth2', '~> 1.2'
|
30
|
+
|
31
|
+
s.add_development_dependency 'rake'
|
32
|
+
s.add_development_dependency 'rspec', '~> 2.13.0'
|
33
|
+
s.add_development_dependency 'rack-test'
|
34
|
+
s.add_development_dependency 'simplecov'
|
35
|
+
# s.add_development_dependency 'debugger'
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::KindfulUser do
|
4
|
+
subject do
|
5
|
+
OmniAuth::Strategies::KindfulUser.new(nil, @options || {})
|
6
|
+
end
|
7
|
+
|
8
|
+
it_should_behave_like 'an oauth2 strategy'
|
9
|
+
|
10
|
+
describe '#client' do
|
11
|
+
it 'should have the correct kindful site' do
|
12
|
+
expect(subject.client.site).to eq("https://client-subdomain.kindful.com")
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should have the correct authorization url' do
|
16
|
+
expect(subject.client.options[:authorize_url]).to eq("/oauth2/authenticate")
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should have the correct token url' do
|
20
|
+
expect(subject.client.options[:token_url]).to eq('/oauth2/token')
|
21
|
+
end
|
22
|
+
|
23
|
+
#TODO find a way to set :provider_ignores_state to true by default
|
24
|
+
# and add a test for it. -masukomi
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start
|
5
|
+
require 'rspec'
|
6
|
+
require 'rack/test'
|
7
|
+
require 'omniauth'
|
8
|
+
require 'omniauth-kindful-user'
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
Dir[File.expand_path('../support/**/*', __FILE__)].each { |f| require f }
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.include Rack::Test::Methods
|
17
|
+
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
18
|
+
OmniAuth.config.test_mode = true
|
19
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# NOTE it would be useful if this lived in omniauth-oauth2 eventually
|
2
|
+
# Thanks to Josh Ellithorpe for this file -Will
|
3
|
+
|
4
|
+
shared_examples 'an oauth2 strategy' do
|
5
|
+
describe '#client' do
|
6
|
+
it 'should be initialized with symbolized client_options' do
|
7
|
+
@options = { :client_options => { 'authorize_url' => 'https://example.com' } }
|
8
|
+
subject.client.options[:authorize_url].should == 'https://example.com'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#authorize_params' do
|
13
|
+
it 'should include any authorize params passed in the :authorize_params option' do
|
14
|
+
@options = { :authorize_params => { :foo => 'bar', :baz => 'zip' } }
|
15
|
+
subject.authorize_params['foo'].should eq('bar')
|
16
|
+
subject.authorize_params['baz'].should eq('zip')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should include top-level options that are marked as :authorize_options' do
|
20
|
+
@options = { :authorize_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
21
|
+
subject.authorize_params['scope'].should eq('bar')
|
22
|
+
subject.authorize_params['foo'].should eq('baz')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#token_params' do
|
27
|
+
it 'should include any token params passed in the :token_params option' do
|
28
|
+
@options = { :token_params => { :foo => 'bar', :baz => 'zip' } }
|
29
|
+
subject.token_params['foo'].should eq('bar')
|
30
|
+
subject.token_params['baz'].should eq('zip')
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should include top-level options that are marked as :token_options' do
|
34
|
+
@options = { :token_options => [:scope, :foo], :scope => 'bar', :foo => 'baz' }
|
35
|
+
subject.token_params['scope'].should eq('bar')
|
36
|
+
subject.token_params['foo'].should eq('baz')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-kindful-user
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- pbrumm
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth
|
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: omniauth-oauth2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.2'
|
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: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.13.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.13.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack-test
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: OmniAuth strategy for Kindful User.
|
98
|
+
email:
|
99
|
+
- pete@kindful.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
106
|
+
- CHANGELOG.md
|
107
|
+
- Gemfile
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- lib/omniauth-kindful-user.rb
|
111
|
+
- lib/omniauth-kindful-user/version.rb
|
112
|
+
- lib/omniauth/strategies/kindful_user.rb
|
113
|
+
- omniauth-kindful-user.gemspec
|
114
|
+
- spec/omniauth/strategies/kindful_user_spec.rb
|
115
|
+
- spec/spec_helper.rb
|
116
|
+
- spec/support/shared_examples.rb
|
117
|
+
homepage: https://github.com/kindful/omniauth-kindful-user
|
118
|
+
licenses:
|
119
|
+
- MIT
|
120
|
+
metadata: {}
|
121
|
+
post_install_message: "Remember to specify \n client_options: {site: \"https://example-client.kindful.com}\nwith
|
122
|
+
the correct subdomain for the client your working with\n"
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project: omniauth-kindful-user
|
138
|
+
rubygems_version: 2.2.2
|
139
|
+
signing_key:
|
140
|
+
specification_version: 4
|
141
|
+
summary: OmniAuth strategy for Kindful User.
|
142
|
+
test_files:
|
143
|
+
- spec/omniauth/strategies/kindful_user_spec.rb
|
144
|
+
- spec/spec_helper.rb
|
145
|
+
- spec/support/shared_examples.rb
|
146
|
+
has_rdoc:
|