doorkeeper 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of doorkeeper might be problematic. Click here for more details.
- data/CHANGELOG.md +7 -0
- data/README.md +8 -4
- data/lib/doorkeeper/version.rb +1 -1
- data/lib/generators/doorkeeper/templates/initializer.rb +4 -8
- data/spec/dummy/config/initializers/doorkeeper.rb +5 -11
- metadata +23 -23
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -101,22 +101,26 @@ You need to configure Doorkeeper in order to provide resource_owner model and au
|
|
101
101
|
|
102
102
|
``` ruby
|
103
103
|
Doorkeeper.configure do
|
104
|
-
resource_owner_authenticator do
|
105
|
-
|
104
|
+
resource_owner_authenticator do
|
105
|
+
User.find(session[:current_user_id]) || redirect_to(login_url)
|
106
106
|
end
|
107
107
|
end
|
108
108
|
```
|
109
109
|
|
110
|
-
This
|
110
|
+
This code is run in the context of your application so you have access to your models, session or routes helpers. However,
|
111
|
+
since this code is not run in the context of your application's ApplicationController it doesn't have access
|
112
|
+
to the methods defined over there.
|
111
113
|
|
112
114
|
If you use [devise](https://github.com/plataformatec/devise), you may want to use warden to authenticate the block:
|
113
115
|
|
114
116
|
``` ruby
|
115
|
-
resource_owner_authenticator do
|
117
|
+
resource_owner_authenticator do
|
116
118
|
current_user || warden.authenticate!(:scope => :user)
|
117
119
|
end
|
118
120
|
```
|
119
121
|
|
122
|
+
Side note: when using devise you have access to current_user as devise extends entire ActionController::Base with the current_#{mapping}.
|
123
|
+
|
120
124
|
If you are not using devise, you may want to check other ways of authentication [here](https://github.com/applicake/doorkeeper/wiki/Authenticating-using-Clearance-DIY).
|
121
125
|
|
122
126
|
## Protecting resources with OAuth (a.k.a your API endpoint)
|
data/lib/doorkeeper/version.rb
CHANGED
@@ -4,22 +4,18 @@ Doorkeeper.configure do
|
|
4
4
|
orm :active_record
|
5
5
|
|
6
6
|
# This block will be called to check whether the resource owner is authenticated or not.
|
7
|
-
resource_owner_authenticator do
|
7
|
+
resource_owner_authenticator do
|
8
8
|
raise "Please configure doorkeeper resource_owner_authenticator block located in #{__FILE__}"
|
9
9
|
# Put your resource owner authentication logic here.
|
10
|
-
# If you want to use named routes from your app, you need to call them on the routes object.
|
11
|
-
# For example:
|
12
|
-
# routes.new_user_session_path
|
13
10
|
# Example implementation:
|
14
|
-
# User.find_by_id(session[:user_id]) || redirect_to(
|
11
|
+
# User.find_by_id(session[:user_id]) || redirect_to(new_user_session_url)
|
15
12
|
end
|
16
13
|
|
17
14
|
# If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below.
|
18
|
-
# admin_authenticator do
|
15
|
+
# admin_authenticator do
|
19
16
|
# # Put your admin authentication logic here.
|
20
|
-
# # If you want to use named routes from your app, you need to call them on routes object, e.g., routes.new_admin_session_path
|
21
17
|
# # Example implementation:
|
22
|
-
# Admin.find_by_id(session[:admin_id]) || redirect_to(
|
18
|
+
# Admin.find_by_id(session[:admin_id]) || redirect_to(new_admin_session_url)
|
23
19
|
# end
|
24
20
|
|
25
21
|
# Authorization Code expiration time (default 10 minutes).
|
@@ -5,24 +5,18 @@ Doorkeeper.configure do
|
|
5
5
|
|
6
6
|
# This block will be called to check whether the
|
7
7
|
# resource owner is authenticated or not
|
8
|
-
resource_owner_authenticator do
|
8
|
+
resource_owner_authenticator do
|
9
9
|
# Put your resource owner authentication logic here.
|
10
|
-
#
|
11
|
-
|
12
|
-
# routes.new_user_session_path
|
13
|
-
# e.g. User.find_by_id(session[:user_id]) || redirect_to(routes.new_user_session_url)
|
14
|
-
User.find_by_id(session[:user_id]) || redirect_to(routes.root_url, :alert => "Needs sign in.")
|
10
|
+
# e.g. User.find_by_id(session[:user_id]) || redirect_to(new_user_session_url)
|
11
|
+
User.find_by_id(session[:user_id]) || redirect_to(root_url, :alert => "Needs sign in.")
|
15
12
|
end
|
16
13
|
|
17
14
|
# If you want to restrict the access to the web interface for
|
18
15
|
# adding oauth authorized applications you need to declare the
|
19
16
|
# block below
|
20
|
-
# admin_authenticator do
|
17
|
+
# admin_authenticator do
|
21
18
|
# # Put your admin authentication logic here.
|
22
|
-
#
|
23
|
-
# # to call them on routes object eg.
|
24
|
-
# # routes.new_admin_session_path
|
25
|
-
# Admin.find_by_id(session[:admin_id]) || redirect_to(routes.new_admin_session_url)
|
19
|
+
# Admin.find_by_id(session[:admin_id]) || redirect_to(new_admin_session_url)
|
26
20
|
# end
|
27
21
|
|
28
22
|
# Authorization Code expiration time (default 10 minutes).
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doorkeeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-11-
|
13
|
+
date: 2012-11-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|
17
|
-
requirement: &
|
17
|
+
requirement: &70219049574960 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '3.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70219049574960
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: sqlite3
|
28
|
-
requirement: &
|
28
|
+
requirement: &70219049571320 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 1.3.5
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70219049571320
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rspec-rails
|
39
|
-
requirement: &
|
39
|
+
requirement: &70219049581140 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 2.11.4
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70219049581140
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: capybara
|
50
|
-
requirement: &
|
50
|
+
requirement: &70219049584040 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 1.1.2
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70219049584040
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: generator_spec
|
61
|
-
requirement: &
|
61
|
+
requirement: &70219049597420 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ~>
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 0.8.5
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70219049597420
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: factory_girl
|
72
|
-
requirement: &
|
72
|
+
requirement: &70219049607540 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 2.6.4
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70219049607540
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: timecop
|
83
|
-
requirement: &
|
83
|
+
requirement: &70219049604780 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: 0.5.2
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *70219049604780
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: database_cleaner
|
94
|
-
requirement: &
|
94
|
+
requirement: &70219049603620 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ~>
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: 0.9.1
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *70219049603620
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: bcrypt-ruby
|
105
|
-
requirement: &
|
105
|
+
requirement: &70219049602680 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
@@ -110,7 +110,7 @@ dependencies:
|
|
110
110
|
version: 3.0.1
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *70219049602680
|
114
114
|
description: Doorkeeper is an OAuth 2 provider for Rails.
|
115
115
|
email:
|
116
116
|
- felipe@applicake.com
|
@@ -360,7 +360,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
360
360
|
version: '0'
|
361
361
|
segments:
|
362
362
|
- 0
|
363
|
-
hash: -
|
363
|
+
hash: -1225818604492077819
|
364
364
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
365
365
|
none: false
|
366
366
|
requirements:
|
@@ -369,10 +369,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
369
369
|
version: '0'
|
370
370
|
segments:
|
371
371
|
- 0
|
372
|
-
hash: -
|
372
|
+
hash: -1225818604492077819
|
373
373
|
requirements: []
|
374
374
|
rubyforge_project:
|
375
|
-
rubygems_version: 1.8.
|
375
|
+
rubygems_version: 1.8.10
|
376
376
|
signing_key:
|
377
377
|
specification_version: 3
|
378
378
|
summary: Doorkeeper is an OAuth 2 provider for Rails.
|