omniauth-redbooth 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/Gemfile.lock +82 -69
- data/README.md +122 -2
- data/examples/config.ru +11 -11
- data/lib/omniauth-redbooth/version.rb +2 -2
- data/omniauth-redbooth.gemspec +1 -2
- data/spec/omniauth/strategies/redbooth_spec.rb +2 -2
- metadata +6 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d36bff3e00803ca7e26eed5bed80d7959e11c3f5
|
4
|
+
data.tar.gz: 9697adb14e93f3bd3d56a26c26d52784d54a0ed8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23fad5ddf7433c6b27f4505bc295cdf8dfddfc02d0e751de8a04d7f0108f466582633dd76cf367ca4ca972cb9c85a8670520858e6f2a816e04ff10e2d0079fad
|
7
|
+
data.tar.gz: 912d5bacc15c0643878d7a6c110cddee7a1a7a7220e12044b86a36d8e78bba1d62abd68a9779a8fd86d5faf3c57e3bd5d42bc8b038c839012af15146f86d48f8
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/Gemfile.lock
CHANGED
@@ -1,118 +1,131 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
omniauth-redbooth (0.0.
|
5
|
-
omniauth (~> 1.0)
|
6
|
-
omniauth-oauth2 (~> 1.1.1)
|
4
|
+
omniauth-redbooth (0.0.3)
|
5
|
+
omniauth-oauth2 (~> 1.2.0)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: http://rubygems.org/
|
10
9
|
specs:
|
11
|
-
addressable (2.3.
|
12
|
-
celluloid (0.
|
13
|
-
timers (~>
|
14
|
-
celluloid-io (0.15.0)
|
15
|
-
celluloid (>= 0.15.0)
|
16
|
-
nio4r (>= 0.5.0)
|
10
|
+
addressable (2.3.7)
|
11
|
+
celluloid (0.16.0)
|
12
|
+
timers (~> 4.0.0)
|
17
13
|
coderay (1.1.0)
|
18
|
-
coveralls (0.7.
|
19
|
-
multi_json (~> 1.
|
20
|
-
rest-client
|
21
|
-
simplecov (
|
22
|
-
term-ansicolor
|
23
|
-
thor
|
14
|
+
coveralls (0.7.10)
|
15
|
+
multi_json (~> 1.10)
|
16
|
+
rest-client (>= 1.6.8, < 2)
|
17
|
+
simplecov (~> 0.9.1)
|
18
|
+
term-ansicolor (~> 1.3)
|
19
|
+
thor (~> 0.19.1)
|
24
20
|
crack (0.4.2)
|
25
21
|
safe_yaml (~> 1.0.0)
|
26
22
|
diff-lcs (1.2.5)
|
27
|
-
docile (1.1.
|
28
|
-
faraday (0.9.
|
23
|
+
docile (1.1.5)
|
24
|
+
faraday (0.9.1)
|
29
25
|
multipart-post (>= 1.2, < 3)
|
30
|
-
ffi (1.9.
|
31
|
-
formatador (0.2.
|
26
|
+
ffi (1.9.6)
|
27
|
+
formatador (0.2.5)
|
32
28
|
growl (1.0.3)
|
33
|
-
guard (2.
|
29
|
+
guard (2.12.2)
|
34
30
|
formatador (>= 0.2.4)
|
35
|
-
listen (~> 2.
|
31
|
+
listen (~> 2.7)
|
36
32
|
lumberjack (~> 1.0)
|
33
|
+
nenv (~> 0.1)
|
34
|
+
notiffany (~> 0.0)
|
37
35
|
pry (>= 0.9.12)
|
36
|
+
shellany (~> 0.0)
|
38
37
|
thor (>= 0.18.1)
|
39
|
-
guard-bundler (2.
|
38
|
+
guard-bundler (2.1.0)
|
40
39
|
bundler (~> 1.0)
|
41
40
|
guard (~> 2.2)
|
42
|
-
|
41
|
+
guard-compat (~> 1.1)
|
42
|
+
guard-compat (1.2.1)
|
43
|
+
guard-rspec (4.5.0)
|
43
44
|
guard (~> 2.1)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
guard-compat (~> 1.1)
|
46
|
+
rspec (>= 2.99.0, < 4.0)
|
47
|
+
hashie (3.4.0)
|
48
|
+
hitimes (1.2.2)
|
49
|
+
jwt (1.2.1)
|
50
|
+
listen (2.8.5)
|
49
51
|
celluloid (>= 0.15.2)
|
50
|
-
celluloid-io (>= 0.15.0)
|
51
52
|
rb-fsevent (>= 0.9.3)
|
52
53
|
rb-inotify (>= 0.9)
|
53
|
-
lumberjack (1.0.
|
54
|
+
lumberjack (1.0.9)
|
54
55
|
method_source (0.8.2)
|
55
|
-
mime-types (2.
|
56
|
-
multi_json (1.
|
56
|
+
mime-types (2.4.3)
|
57
|
+
multi_json (1.10.1)
|
57
58
|
multi_xml (0.5.5)
|
58
59
|
multipart-post (2.0.0)
|
59
|
-
|
60
|
-
|
60
|
+
nenv (0.2.0)
|
61
|
+
netrc (0.10.2)
|
62
|
+
notiffany (0.0.6)
|
63
|
+
nenv (~> 0.1)
|
64
|
+
shellany (~> 0.0)
|
65
|
+
oauth2 (1.0.0)
|
61
66
|
faraday (>= 0.8, < 0.10)
|
62
|
-
jwt (~>
|
67
|
+
jwt (~> 1.0)
|
63
68
|
multi_json (~> 1.3)
|
64
69
|
multi_xml (~> 0.5)
|
65
70
|
rack (~> 1.2)
|
66
|
-
omniauth (1.2.
|
67
|
-
hashie (>= 1.2, <
|
71
|
+
omniauth (1.2.2)
|
72
|
+
hashie (>= 1.2, < 4)
|
68
73
|
rack (~> 1.0)
|
69
|
-
omniauth-oauth2 (1.
|
74
|
+
omniauth-oauth2 (1.2.0)
|
70
75
|
faraday (>= 0.8, < 0.10)
|
71
76
|
multi_json (~> 1.3)
|
72
|
-
oauth2 (~> 0
|
77
|
+
oauth2 (~> 1.0)
|
73
78
|
omniauth (~> 1.2)
|
74
|
-
pry (0.
|
75
|
-
coderay (~> 1.0)
|
76
|
-
method_source (~> 0.8)
|
79
|
+
pry (0.10.1)
|
80
|
+
coderay (~> 1.1.0)
|
81
|
+
method_source (~> 0.8.1)
|
77
82
|
slop (~> 3.4)
|
78
|
-
rack (1.
|
79
|
-
rack-protection (1.5.
|
83
|
+
rack (1.6.0)
|
84
|
+
rack-protection (1.5.3)
|
80
85
|
rack
|
81
|
-
rack-test (0.6.
|
86
|
+
rack-test (0.6.3)
|
82
87
|
rack (>= 1.0)
|
83
|
-
rake (10.
|
88
|
+
rake (10.4.2)
|
84
89
|
rb-fsevent (0.9.4)
|
85
|
-
rb-inotify (0.9.
|
90
|
+
rb-inotify (0.9.5)
|
86
91
|
ffi (>= 0.5.0)
|
87
|
-
rest-client (1.
|
88
|
-
mime-types (>= 1.16)
|
89
|
-
|
90
|
-
|
91
|
-
rspec-
|
92
|
-
rspec-
|
93
|
-
|
94
|
-
rspec-
|
95
|
-
|
96
|
-
rspec-
|
97
|
-
|
98
|
-
|
92
|
+
rest-client (1.7.2)
|
93
|
+
mime-types (>= 1.16, < 3.0)
|
94
|
+
netrc (~> 0.7)
|
95
|
+
rspec (3.2.0)
|
96
|
+
rspec-core (~> 3.2.0)
|
97
|
+
rspec-expectations (~> 3.2.0)
|
98
|
+
rspec-mocks (~> 3.2.0)
|
99
|
+
rspec-core (3.2.0)
|
100
|
+
rspec-support (~> 3.2.0)
|
101
|
+
rspec-expectations (3.2.0)
|
102
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
103
|
+
rspec-support (~> 3.2.0)
|
104
|
+
rspec-mocks (3.2.0)
|
105
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
106
|
+
rspec-support (~> 3.2.0)
|
107
|
+
rspec-support (3.2.1)
|
108
|
+
safe_yaml (1.0.4)
|
109
|
+
shellany (0.0.1)
|
110
|
+
simplecov (0.9.2)
|
99
111
|
docile (~> 1.1.0)
|
100
|
-
multi_json
|
101
|
-
simplecov-html (~> 0.
|
102
|
-
simplecov-html (0.
|
103
|
-
sinatra (1.4.
|
112
|
+
multi_json (~> 1.0)
|
113
|
+
simplecov-html (~> 0.9.0)
|
114
|
+
simplecov-html (0.9.0)
|
115
|
+
sinatra (1.4.5)
|
104
116
|
rack (~> 1.4)
|
105
117
|
rack-protection (~> 1.4)
|
106
118
|
tilt (~> 1.3, >= 1.3.4)
|
107
|
-
slop (3.
|
119
|
+
slop (3.6.0)
|
108
120
|
term-ansicolor (1.3.0)
|
109
121
|
tins (~> 1.0)
|
110
|
-
thor (0.
|
122
|
+
thor (0.19.1)
|
111
123
|
tilt (1.4.1)
|
112
|
-
timers (
|
113
|
-
|
114
|
-
|
115
|
-
|
124
|
+
timers (4.0.1)
|
125
|
+
hitimes
|
126
|
+
tins (1.3.4)
|
127
|
+
webmock (1.20.4)
|
128
|
+
addressable (>= 2.3.6)
|
116
129
|
crack (>= 0.3.2)
|
117
130
|
|
118
131
|
PLATFORMS
|
data/README.md
CHANGED
@@ -1,8 +1,49 @@
|
|
1
|
-
# OmniAuth Redbooth
|
1
|
+
# OmniAuth Redbooth Platform
|
2
2
|
|
3
|
-
An official OmniAuth strategy for authenticating
|
3
|
+
An official OmniAuth strategy for authenticating with Redbooth Platform using OAuth2. To use it, you'll
|
4
4
|
need to have a Redbooth.com [developer account](http://developer.redbooth.com/).
|
5
5
|
|
6
|
+
# Getting Oauth credentials
|
7
|
+
|
8
|
+
First thing you need to do it's getting your own oauth app credentials. To do so please follow up the intructions given in the redbooth platform site
|
9
|
+
|
10
|
+
https://redbooth.com/api/getting-started/
|
11
|
+
|
12
|
+
# Examples
|
13
|
+
|
14
|
+
We provide you a sinatra example to test that everything works properly. If you want to make it run you just need to:
|
15
|
+
|
16
|
+
1. Clone this repo
|
17
|
+
|
18
|
+
```
|
19
|
+
git@github.com:teambox/omniauth-redbooth.git
|
20
|
+
cd omniauth-redbooth
|
21
|
+
```
|
22
|
+
|
23
|
+
2. Install dependencies
|
24
|
+
|
25
|
+
```
|
26
|
+
bundle install
|
27
|
+
```
|
28
|
+
|
29
|
+
3. Create an ouath app with `http://localhost:9292/auth/redbooth/callback` as one of the redirect uris.
|
30
|
+
|
31
|
+
4. Setup your credentials
|
32
|
+
|
33
|
+
```
|
34
|
+
export CLIENT_ID=_your_client_id_
|
35
|
+
export CLIENT_SECRET=_your_client_secret_
|
36
|
+
```
|
37
|
+
|
38
|
+
5. Run the sinatra instance
|
39
|
+
|
40
|
+
```
|
41
|
+
bundle exec rackup examples/config.ru
|
42
|
+
```
|
43
|
+
|
44
|
+
6. go live! http://localhost:9292
|
45
|
+
|
46
|
+
|
6
47
|
## Installation
|
7
48
|
|
8
49
|
Add to your `Gemfile`:
|
@@ -24,3 +65,82 @@ end
|
|
24
65
|
```
|
25
66
|
|
26
67
|
You can now access the URL: `/auth/redbooth`
|
68
|
+
|
69
|
+
# Auth Hash
|
70
|
+
|
71
|
+
Here's an example Auth Hash available in request.env['omniauth.auth']
|
72
|
+
|
73
|
+
```json
|
74
|
+
{
|
75
|
+
"provider": "redbooth",
|
76
|
+
"uid": 656485,
|
77
|
+
"info": {
|
78
|
+
"name": "Andrés Bravo",
|
79
|
+
"email": "andres.bravo@redbooth.com"
|
80
|
+
},
|
81
|
+
"credentials": {
|
82
|
+
"token": "b0e722c2c7a94f20de4blol439579ac06b26ed89a",
|
83
|
+
"refresh_token": "36d4706cdf4efedlol6dde1dac1b637b7",
|
84
|
+
"expires_at": 1409939217,
|
85
|
+
"expires": true
|
86
|
+
},
|
87
|
+
"extra": {
|
88
|
+
"raw_info": {
|
89
|
+
"type": "User",
|
90
|
+
"created_at": 1370420186,
|
91
|
+
"updated_at": 1409904971,
|
92
|
+
"id": 65642185,
|
93
|
+
"first_name": "Andrés",
|
94
|
+
"last_name": "Bravo",
|
95
|
+
"email": "andres.bravo@redbooth.com",
|
96
|
+
"needs_profile": false,
|
97
|
+
"deleted": false,
|
98
|
+
"bouncing_email": false,
|
99
|
+
"confirmed_user": true,
|
100
|
+
"username": "lol",
|
101
|
+
"avatar_url": "https://secure.gravatar.com/avatar/5de4c7ba680c829033alolfd29?size=48&default=mm",
|
102
|
+
"profile_avatar_url": "https://secure.gravatar.com/avatar/5de4c7ba680clolf86afd29?size=278&default=mm",
|
103
|
+
"micro_avatar_url": "https://secure.gravatar.com/avatar/5de4c7ba68lol3ac0ed1f86afd29?size=24&default=mm",
|
104
|
+
"first_day_of_week": "monday",
|
105
|
+
"biography": "developer",
|
106
|
+
"locale": "en",
|
107
|
+
"time_zone": "Madrid",
|
108
|
+
"default_digest": 4,
|
109
|
+
"notify_conversations": false,
|
110
|
+
"notify_tasks": false,
|
111
|
+
"notify_pages": false,
|
112
|
+
"default_watch_new_task": false,
|
113
|
+
"default_watch_new_conversation": false,
|
114
|
+
"default_watch_new_page": false,
|
115
|
+
"digest_delivery_hour": 12,
|
116
|
+
"wants_task_reminder": false,
|
117
|
+
"rss_token": "30804ee9a4c59lol3179883b089c95",
|
118
|
+
"calendar_token": "a86ba8c08f0lolf16513c9a52f9",
|
119
|
+
"shortcut_apps": null,
|
120
|
+
"project_activity_digest": "no_digest",
|
121
|
+
"chat_token": "38bece53lol5f61532d",
|
122
|
+
"do_not_disturb_at": null,
|
123
|
+
"is_pro": true
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
```
|
129
|
+
|
130
|
+
# Token Expiry
|
131
|
+
|
132
|
+
The `access_token` expiration time the its 7200 sec. After that you will need to perform refresh flow.
|
133
|
+
|
134
|
+
The `refresh_token` will be refreshed at the same time you ask for a new `access_token` remember to store it after the refresh token flow.
|
135
|
+
|
136
|
+
# License
|
137
|
+
|
138
|
+
Copyright (c) 2012 by Redbooth
|
139
|
+
|
140
|
+
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:
|
141
|
+
|
142
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
143
|
+
|
144
|
+
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.
|
145
|
+
|
146
|
+
|
data/examples/config.ru
CHANGED
@@ -27,12 +27,12 @@ class OmniauthRedbooth < Sinatra::Base
|
|
27
27
|
end
|
28
28
|
|
29
29
|
get '/refresh_token' do
|
30
|
-
client_id = ENV['
|
31
|
-
client_secret = ENV['
|
30
|
+
client_id = ENV['CLIENT_ID'] || '_your_consumer_key_'
|
31
|
+
client_secret = ENV['CLIENT_SECRET'] || '_your_consumer_secret_'
|
32
32
|
oauth2_urls = {
|
33
|
-
site: '
|
34
|
-
token_url: '
|
35
|
-
authorize_url: '
|
33
|
+
site: 'https://redbooth.com/api/3',
|
34
|
+
token_url: 'https://redbooth.com/oauth2/token',
|
35
|
+
authorize_url: 'https://redbooth.com/oauth2/authorize'
|
36
36
|
}
|
37
37
|
|
38
38
|
@oauth2_client = OAuth2::Client.new(client_id, client_secret, oauth2_urls)
|
@@ -47,13 +47,13 @@ end
|
|
47
47
|
use Rack::Session::Cookie, :secret => 'secret identity'
|
48
48
|
|
49
49
|
use OmniAuth::Builder do
|
50
|
-
provider :redbooth,
|
51
|
-
ENV['
|
52
|
-
ENV['
|
50
|
+
provider :redbooth,
|
51
|
+
ENV['CLIENT_ID'] || '_your_consumer_key_',
|
52
|
+
ENV['CLIENT_SECRET'] || '_your_consumer_secret_',
|
53
53
|
client_options: {
|
54
|
-
site: '
|
55
|
-
token_url: '
|
56
|
-
authorize_url: '
|
54
|
+
site: 'https://redbooth.com/api/3',
|
55
|
+
token_url: 'https://redbooth.com/oauth2/token',
|
56
|
+
authorize_url: 'https://redbooth.com/oauth2/authorize'
|
57
57
|
},
|
58
58
|
scope: 'all'
|
59
59
|
end
|
data/omniauth-redbooth.gemspec
CHANGED
@@ -13,8 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.require_paths = ["lib"]
|
14
14
|
gem.version = OmniAuth::Redbooth::VERSION
|
15
15
|
|
16
|
-
gem.add_dependency 'omniauth', '~> 1.0'
|
17
|
-
gem.add_dependency 'omniauth-oauth2', '~> 1.1.1'
|
16
|
+
gem.add_dependency 'omniauth-oauth2', '~> 1.2.0'
|
18
17
|
gem.add_development_dependency 'rspec', '~> 2.7'
|
19
18
|
gem.add_development_dependency 'rack-test'
|
20
19
|
gem.add_development_dependency 'simplecov'
|
@@ -30,11 +30,11 @@ describe OmniAuth::Strategies::Redbooth do
|
|
30
30
|
describe '#client_options' do
|
31
31
|
|
32
32
|
it 'should be initialized with correct authorize url' do
|
33
|
-
expect(subject.client.options[:authorize_url]).to eql 'https://redbooth.com/
|
33
|
+
expect(subject.client.options[:authorize_url]).to eql 'https://redbooth.com/oauth2/authorize'
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'should be initialized with correct token url' do
|
37
|
-
expect(subject.client.options[:token_url]).to eql 'https://redbooth.com/
|
37
|
+
expect(subject.client.options[:token_url]).to eql 'https://redbooth.com/oauth2/token'
|
38
38
|
end
|
39
39
|
|
40
40
|
describe "overrides" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-redbooth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andres Bravo
|
@@ -10,36 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: omniauth
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
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
|
-
requirements:
|
26
|
-
- - "~>"
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: '1.0'
|
29
15
|
- !ruby/object:Gem::Dependency
|
30
16
|
name: omniauth-oauth2
|
31
17
|
requirement: !ruby/object:Gem::Requirement
|
32
18
|
requirements:
|
33
19
|
- - "~>"
|
34
20
|
- !ruby/object:Gem::Version
|
35
|
-
version: 1.
|
21
|
+
version: 1.2.0
|
36
22
|
type: :runtime
|
37
23
|
prerelease: false
|
38
24
|
version_requirements: !ruby/object:Gem::Requirement
|
39
25
|
requirements:
|
40
26
|
- - "~>"
|
41
27
|
- !ruby/object:Gem::Version
|
42
|
-
version: 1.
|
28
|
+
version: 1.2.0
|
43
29
|
- !ruby/object:Gem::Dependency
|
44
30
|
name: rspec
|
45
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,6 +90,7 @@ extensions: []
|
|
104
90
|
extra_rdoc_files: []
|
105
91
|
files:
|
106
92
|
- ".gitignore"
|
93
|
+
- ".rspec"
|
107
94
|
- ".travis.yml"
|
108
95
|
- Gemfile
|
109
96
|
- Gemfile.lock
|
@@ -137,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
124
|
version: '0'
|
138
125
|
requirements: []
|
139
126
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.4.5
|
141
128
|
signing_key:
|
142
129
|
specification_version: 4
|
143
130
|
summary: Official OmniAuth strategy for Redbooth.com.
|