doorkeeper 3.1.0 → 4.4.3

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.

Files changed (195) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.github/ISSUE_TEMPLATE.md +25 -0
  4. data/.github/PULL_REQUEST_TEMPLATE.md +17 -0
  5. data/.gitignore +6 -1
  6. data/.hound.yml +2 -13
  7. data/.rubocop.yml +17 -0
  8. data/.travis.yml +26 -10
  9. data/Appraisals +18 -0
  10. data/CODE_OF_CONDUCT.md +46 -0
  11. data/CONTRIBUTING.md +2 -0
  12. data/Gemfile +5 -5
  13. data/NEWS.md +141 -2
  14. data/README.md +149 -66
  15. data/RELEASING.md +5 -12
  16. data/Rakefile +1 -1
  17. data/SECURITY.md +15 -0
  18. data/app/controllers/doorkeeper/application_controller.rb +4 -6
  19. data/app/controllers/doorkeeper/application_metal_controller.rb +3 -2
  20. data/app/controllers/doorkeeper/applications_controller.rb +18 -8
  21. data/app/controllers/doorkeeper/authorizations_controller.rb +1 -1
  22. data/app/controllers/doorkeeper/authorized_applications_controller.rb +1 -1
  23. data/app/controllers/doorkeeper/tokens_controller.rb +62 -15
  24. data/app/helpers/doorkeeper/dashboard_helper.rb +14 -10
  25. data/app/validators/redirect_uri_validator.rb +12 -2
  26. data/app/views/doorkeeper/applications/_delete_form.html.erb +1 -2
  27. data/app/views/doorkeeper/applications/_form.html.erb +13 -2
  28. data/app/views/doorkeeper/applications/index.html.erb +2 -0
  29. data/app/views/doorkeeper/applications/show.html.erb +4 -1
  30. data/app/views/doorkeeper/authorizations/new.html.erb +1 -1
  31. data/app/views/doorkeeper/authorized_applications/_delete_form.html.erb +1 -2
  32. data/app/views/doorkeeper/authorized_applications/index.html.erb +0 -1
  33. data/app/views/layouts/doorkeeper/admin.html.erb +1 -1
  34. data/config/locales/en.yml +12 -7
  35. data/doorkeeper.gemspec +16 -11
  36. data/gemfiles/rails_4_2.gemfile +13 -0
  37. data/gemfiles/rails_5_0.gemfile +12 -0
  38. data/gemfiles/rails_5_1.gemfile +12 -0
  39. data/gemfiles/rails_5_2.gemfile +12 -0
  40. data/gemfiles/rails_master.gemfile +14 -0
  41. data/lib/doorkeeper/config.rb +119 -46
  42. data/lib/doorkeeper/engine.rb +11 -7
  43. data/lib/doorkeeper/errors.rb +18 -0
  44. data/lib/doorkeeper/grape/helpers.rb +14 -8
  45. data/lib/doorkeeper/helpers/controller.rb +8 -19
  46. data/lib/doorkeeper/models/access_grant_mixin.rb +10 -21
  47. data/lib/doorkeeper/models/access_token_mixin.rb +147 -43
  48. data/lib/doorkeeper/models/application_mixin.rb +33 -35
  49. data/lib/doorkeeper/models/concerns/accessible.rb +4 -0
  50. data/lib/doorkeeper/models/concerns/expirable.rb +15 -5
  51. data/lib/doorkeeper/models/concerns/orderable.rb +13 -0
  52. data/lib/doorkeeper/models/concerns/ownership.rb +6 -1
  53. data/lib/doorkeeper/models/concerns/revocable.rb +37 -2
  54. data/lib/doorkeeper/oauth/authorization/token.rb +22 -18
  55. data/lib/doorkeeper/oauth/authorization/uri_builder.rb +20 -18
  56. data/lib/doorkeeper/oauth/authorization_code_request.rb +7 -5
  57. data/lib/doorkeeper/oauth/{request_concern.rb → base_request.rb} +9 -2
  58. data/lib/doorkeeper/oauth/base_response.rb +29 -0
  59. data/lib/doorkeeper/oauth/client/credentials.rb +21 -8
  60. data/lib/doorkeeper/oauth/client.rb +2 -3
  61. data/lib/doorkeeper/oauth/client_credentials/creator.rb +1 -1
  62. data/lib/doorkeeper/oauth/client_credentials/issuer.rb +3 -2
  63. data/lib/doorkeeper/oauth/client_credentials/validation.rb +1 -1
  64. data/lib/doorkeeper/oauth/client_credentials_request.rb +8 -8
  65. data/lib/doorkeeper/oauth/code_response.rb +16 -16
  66. data/lib/doorkeeper/oauth/error.rb +2 -2
  67. data/lib/doorkeeper/oauth/error_response.rb +10 -10
  68. data/lib/doorkeeper/oauth/forbidden_token_response.rb +1 -1
  69. data/lib/doorkeeper/oauth/helpers/scope_checker.rb +1 -1
  70. data/lib/doorkeeper/oauth/helpers/uri_checker.rb +17 -1
  71. data/lib/doorkeeper/oauth/invalid_token_response.rb +5 -4
  72. data/lib/doorkeeper/oauth/password_access_token_request.rb +8 -13
  73. data/lib/doorkeeper/oauth/pre_authorization.rb +5 -3
  74. data/lib/doorkeeper/oauth/refresh_token_request.rb +23 -14
  75. data/lib/doorkeeper/oauth/scopes.rb +18 -8
  76. data/lib/doorkeeper/oauth/token.rb +20 -21
  77. data/lib/doorkeeper/oauth/token_introspection.rb +128 -0
  78. data/lib/doorkeeper/oauth/token_request.rb +1 -2
  79. data/lib/doorkeeper/oauth/token_response.rb +1 -1
  80. data/lib/doorkeeper/orm/active_record/access_grant.rb +27 -0
  81. data/lib/doorkeeper/orm/active_record/access_token.rb +34 -8
  82. data/lib/doorkeeper/orm/active_record/application.rb +48 -11
  83. data/lib/doorkeeper/orm/active_record.rb +17 -22
  84. data/lib/doorkeeper/rails/helpers.rb +6 -9
  85. data/lib/doorkeeper/rails/routes/mapper.rb +4 -4
  86. data/lib/doorkeeper/rails/routes/mapping.rb +1 -1
  87. data/lib/doorkeeper/rails/routes.rb +17 -11
  88. data/lib/doorkeeper/request/authorization_code.rb +7 -1
  89. data/lib/doorkeeper/request/password.rb +2 -2
  90. data/lib/doorkeeper/request/refresh_token.rb +1 -1
  91. data/lib/doorkeeper/request.rb +7 -1
  92. data/lib/doorkeeper/server.rb +0 -8
  93. data/lib/doorkeeper/validations.rb +3 -2
  94. data/lib/doorkeeper/version.rb +34 -1
  95. data/lib/doorkeeper.rb +10 -2
  96. data/lib/generators/doorkeeper/add_client_confidentiality_generator.rb +31 -0
  97. data/lib/generators/doorkeeper/application_owner_generator.rb +11 -2
  98. data/lib/generators/doorkeeper/migration_generator.rb +13 -1
  99. data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +35 -0
  100. data/lib/generators/doorkeeper/templates/add_confidential_to_application_migration.rb.erb +11 -0
  101. data/{spec/dummy/db/migrate/20130902175349_add_owner_to_application.rb → lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb.erb} +1 -1
  102. data/lib/generators/doorkeeper/templates/add_previous_refresh_token_to_access_tokens.rb.erb +11 -0
  103. data/lib/generators/doorkeeper/templates/initializer.rb +38 -6
  104. data/lib/generators/doorkeeper/templates/migration.rb.erb +69 -0
  105. data/spec/controllers/application_metal_controller.rb +10 -0
  106. data/spec/controllers/applications_controller_spec.rb +15 -4
  107. data/spec/controllers/authorizations_controller_spec.rb +74 -27
  108. data/spec/controllers/protected_resources_controller_spec.rb +70 -32
  109. data/spec/controllers/token_info_controller_spec.rb +17 -13
  110. data/spec/controllers/tokens_controller_spec.rb +198 -12
  111. data/spec/dummy/app/controllers/full_protected_resources_controller.rb +4 -4
  112. data/spec/dummy/app/controllers/home_controller.rb +1 -1
  113. data/spec/dummy/app/controllers/metal_controller.rb +1 -1
  114. data/spec/dummy/app/controllers/semi_protected_resources_controller.rb +3 -3
  115. data/spec/dummy/app/models/user.rb +0 -4
  116. data/spec/dummy/config/application.rb +2 -36
  117. data/spec/dummy/config/environment.rb +1 -1
  118. data/spec/dummy/config/environments/test.rb +4 -15
  119. data/spec/dummy/config/initializers/doorkeeper.rb +19 -3
  120. data/spec/dummy/config/initializers/new_framework_defaults.rb +6 -0
  121. data/spec/dummy/config/initializers/secret_token.rb +0 -1
  122. data/spec/dummy/db/migrate/20111122132257_create_users.rb +3 -1
  123. data/spec/dummy/db/migrate/20120312140401_add_password_to_users.rb +3 -1
  124. data/{lib/generators/doorkeeper/templates/migration.rb → spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb} +16 -4
  125. data/{lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb → spec/dummy/db/migrate/20151223200000_add_owner_to_application.rb} +4 -2
  126. data/spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb +13 -0
  127. data/spec/dummy/db/migrate/20180210183654_add_confidential_to_application.rb +13 -0
  128. data/spec/dummy/db/schema.rb +24 -22
  129. data/spec/factories.rb +4 -2
  130. data/spec/generators/application_owner_generator_spec.rb +24 -5
  131. data/spec/generators/migration_generator_spec.rb +24 -3
  132. data/spec/generators/previous_refresh_token_generator_spec.rb +57 -0
  133. data/spec/grape/grape_integration_spec.rb +135 -0
  134. data/spec/helpers/doorkeeper/dashboard_helper_spec.rb +1 -1
  135. data/spec/lib/config_spec.rb +159 -14
  136. data/spec/lib/doorkeeper_spec.rb +135 -13
  137. data/spec/lib/models/expirable_spec.rb +0 -1
  138. data/spec/lib/models/revocable_spec.rb +27 -4
  139. data/spec/lib/oauth/authorization/uri_builder_spec.rb +1 -2
  140. data/spec/lib/oauth/authorization_code_request_spec.rb +55 -12
  141. data/spec/lib/oauth/base_request_spec.rb +155 -0
  142. data/spec/lib/oauth/base_response_spec.rb +45 -0
  143. data/spec/lib/oauth/client/credentials_spec.rb +45 -2
  144. data/spec/lib/oauth/client_credentials/creator_spec.rb +1 -1
  145. data/spec/lib/oauth/client_credentials_integration_spec.rb +1 -1
  146. data/spec/lib/oauth/client_credentials_request_spec.rb +1 -0
  147. data/spec/lib/oauth/code_request_spec.rb +1 -3
  148. data/spec/lib/oauth/code_response_spec.rb +34 -0
  149. data/spec/lib/oauth/error_response_spec.rb +9 -9
  150. data/spec/lib/oauth/error_spec.rb +1 -1
  151. data/spec/lib/oauth/helpers/uri_checker_spec.rb +115 -1
  152. data/spec/lib/oauth/invalid_token_response_spec.rb +36 -8
  153. data/spec/lib/oauth/password_access_token_request_spec.rb +14 -8
  154. data/spec/lib/oauth/pre_authorization_spec.rb +12 -7
  155. data/spec/lib/oauth/refresh_token_request_spec.rb +52 -9
  156. data/spec/lib/oauth/scopes_spec.rb +28 -2
  157. data/spec/lib/oauth/token_request_spec.rb +6 -8
  158. data/spec/lib/oauth/token_spec.rb +12 -5
  159. data/spec/lib/server_spec.rb +10 -3
  160. data/spec/models/doorkeeper/access_grant_spec.rb +1 -1
  161. data/spec/models/doorkeeper/access_token_spec.rb +116 -48
  162. data/spec/models/doorkeeper/application_spec.rb +145 -29
  163. data/spec/requests/applications/applications_request_spec.rb +5 -5
  164. data/spec/requests/endpoints/authorization_spec.rb +5 -6
  165. data/spec/requests/endpoints/token_spec.rb +8 -1
  166. data/spec/requests/flows/authorization_code_errors_spec.rb +11 -1
  167. data/spec/requests/flows/authorization_code_spec.rb +6 -13
  168. data/spec/requests/flows/client_credentials_spec.rb +29 -1
  169. data/spec/requests/flows/implicit_grant_errors_spec.rb +2 -2
  170. data/spec/requests/flows/password_spec.rb +118 -15
  171. data/spec/requests/flows/refresh_token_spec.rb +89 -19
  172. data/spec/requests/flows/revoke_token_spec.rb +105 -91
  173. data/spec/requests/protected_resources/metal_spec.rb +1 -1
  174. data/spec/requests/protected_resources/private_api_spec.rb +1 -1
  175. data/spec/routing/custom_controller_routes_spec.rb +4 -0
  176. data/spec/routing/default_routes_spec.rb +5 -1
  177. data/spec/spec_helper.rb +2 -0
  178. data/spec/spec_helper_integration.rb +22 -4
  179. data/spec/support/dependencies/factory_girl.rb +2 -2
  180. data/spec/support/helpers/access_token_request_helper.rb +1 -1
  181. data/spec/support/helpers/model_helper.rb +34 -7
  182. data/spec/support/helpers/request_spec_helper.rb +17 -5
  183. data/spec/support/helpers/url_helper.rb +9 -8
  184. data/spec/support/http_method_shim.rb +38 -0
  185. data/spec/support/shared/controllers_shared_context.rb +15 -10
  186. data/spec/support/shared/models_shared_examples.rb +5 -5
  187. data/spec/validators/redirect_uri_validator_spec.rb +51 -6
  188. data/spec/version/version_spec.rb +15 -0
  189. metadata +128 -46
  190. data/lib/doorkeeper/oauth/client/methods.rb +0 -18
  191. data/lib/generators/doorkeeper/application_scopes_generator.rb +0 -34
  192. data/lib/generators/doorkeeper/templates/add_scopes_to_oauth_applications.rb +0 -5
  193. data/spec/dummy/db/migrate/20130902165751_create_doorkeeper_tables.rb +0 -41
  194. data/spec/dummy/db/migrate/20141209001746_add_scopes_to_oauth_applications.rb +0 -5
  195. data/spec/lib/oauth/client/methods_spec.rb +0 -54
@@ -2,7 +2,7 @@ require 'spec_helper_integration'
2
2
 
3
3
  describe RedirectUriValidator do
4
4
  subject do
5
- FactoryGirl.create(:application)
5
+ FactoryBot.create(:application)
6
6
  end
7
7
 
8
8
  it 'is valid when the uri is a uri' do
@@ -10,6 +10,21 @@ describe RedirectUriValidator do
10
10
  expect(subject).to be_valid
11
11
  end
12
12
 
13
+ # Most mobile and desktop operating systems allow apps to register a custom URL
14
+ # scheme that will launch the app when a URL with that scheme is visited from
15
+ # the system browser.
16
+ #
17
+ # @see https://www.oauth.com/oauth2-servers/redirect-uris/redirect-uris-native-apps/
18
+ it 'is valid when the uri is custom native URI' do
19
+ subject.redirect_uri = 'myapp://callback'
20
+ expect(subject).to be_valid
21
+ end
22
+
23
+ it 'is valid when the uri has a query parameter' do
24
+ subject.redirect_uri = 'https://example.com/abcd?xyz=123'
25
+ expect(subject).to be_valid
26
+ end
27
+
13
28
  it 'accepts native redirect uri' do
14
29
  subject.redirect_uri = 'urn:ietf:wg:oauth:2.0:oob'
15
30
  expect(subject).to be_valid
@@ -39,11 +54,6 @@ describe RedirectUriValidator do
39
54
  expect(subject.errors[:redirect_uri].first).to eq('cannot contain a fragment.')
40
55
  end
41
56
 
42
- it 'is invalid when the uri has a query parameter' do
43
- subject.redirect_uri = 'https://example.com/abcd?xyz=123'
44
- expect(subject).to be_valid
45
- end
46
-
47
57
  context 'force secured uri' do
48
58
  it 'accepts an valid uri' do
49
59
  subject.redirect_uri = 'https://example.com/callback'
@@ -68,6 +78,34 @@ describe RedirectUriValidator do
68
78
  expect(subject).to be_valid
69
79
  end
70
80
 
81
+ it 'accepts a non secured protocol when conditional option defined' do
82
+ Doorkeeper.configure do
83
+ orm DOORKEEPER_ORM
84
+ force_ssl_in_redirect_uri { |uri| uri.host != 'localhost' }
85
+ end
86
+
87
+ application = FactoryBot.build(:application, redirect_uri: 'http://localhost/callback')
88
+ expect(application).to be_valid
89
+
90
+ application = FactoryBot.build(:application, redirect_uri: 'http://localhost2/callback')
91
+ expect(application).not_to be_valid
92
+ end
93
+
94
+ it 'forbids redirect uri if required' do
95
+ subject.redirect_uri = 'javascript://document.cookie'
96
+
97
+ Doorkeeper.configure do
98
+ orm DOORKEEPER_ORM
99
+ forbid_redirect_uri { |uri| uri.scheme == 'javascript' }
100
+ end
101
+
102
+ expect(subject).to be_invalid
103
+ expect(subject.errors[:redirect_uri].first).to eq('is forbidden by the server.')
104
+
105
+ subject.redirect_uri = 'https://localhost/callback'
106
+ expect(subject).to be_valid
107
+ end
108
+
71
109
  it 'invalidates the uri when the uri does not use a secure protocol' do
72
110
  subject.redirect_uri = 'http://example.com/callback'
73
111
  expect(subject).not_to be_valid
@@ -75,4 +113,11 @@ describe RedirectUriValidator do
75
113
  expect(error).to eq('must be an HTTPS/SSL URI.')
76
114
  end
77
115
  end
116
+
117
+ context 'multiple redirect uri' do
118
+ it 'invalidates the second uri when the first uri is native uri' do
119
+ subject.redirect_uri = "urn:ietf:wg:oauth:2.0:oob\nexample.com/callback"
120
+ expect(subject).to be_invalid
121
+ end
122
+ end
78
123
  end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper_integration'
2
+
3
+ describe 'Doorkeeper version' do
4
+ context '#gem_version' do
5
+ it 'returns Gem::Version instance' do
6
+ expect(Doorkeeper.gem_version).to be_an_instance_of(Gem::Version)
7
+ end
8
+ end
9
+
10
+ context 'VERSION' do
11
+ it 'returns gem version string' do
12
+ expect(Doorkeeper::VERSION::STRING).to match(/^\d+\.\d+\.\d+[.\w]?$/)
13
+ end
14
+ end
15
+ end
metadata CHANGED
@@ -1,15 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 4.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Elias Philipp
8
8
  - Tute Costa
9
+ - Jon Moss
10
+ - Nikita Bulai
9
11
  autorequire:
10
12
  bindir: bin
11
13
  cert_chain: []
12
- date: 2015-12-23 00:00:00.000000000 Z
14
+ date: 2018-09-19 00:00:00.000000000 Z
13
15
  dependencies:
14
16
  - !ruby/object:Gem::Dependency
15
17
  name: railties
@@ -17,109 +19,143 @@ dependencies:
17
19
  requirements:
18
20
  - - ">="
19
21
  - !ruby/object:Gem::Version
20
- version: '3.2'
22
+ version: '4.2'
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
27
- version: '3.2'
29
+ version: '4.2'
28
30
  - !ruby/object:Gem::Dependency
29
- name: rspec-rails
31
+ name: capybara
30
32
  requirement: !ruby/object:Gem::Requirement
31
33
  requirements:
32
- - - "~>"
34
+ - - ">="
33
35
  - !ruby/object:Gem::Version
34
- version: 3.4.0
36
+ version: '0'
35
37
  type: :development
36
38
  prerelease: false
37
39
  version_requirements: !ruby/object:Gem::Requirement
38
40
  requirements:
39
- - - "~>"
41
+ - - ">="
40
42
  - !ruby/object:Gem::Version
41
- version: 3.4.0
43
+ version: '0'
42
44
  - !ruby/object:Gem::Dependency
43
- name: capybara
45
+ name: coveralls
44
46
  requirement: !ruby/object:Gem::Requirement
45
47
  requirements:
46
- - - "~>"
48
+ - - ">="
47
49
  - !ruby/object:Gem::Version
48
- version: 2.3.0
50
+ version: '0'
49
51
  type: :development
50
52
  prerelease: false
51
53
  version_requirements: !ruby/object:Gem::Requirement
52
54
  requirements:
53
- - - "~>"
55
+ - - ">="
54
56
  - !ruby/object:Gem::Version
55
- version: 2.3.0
57
+ version: '0'
56
58
  - !ruby/object:Gem::Dependency
57
- name: generator_spec
59
+ name: grape
58
60
  requirement: !ruby/object:Gem::Requirement
59
61
  requirements:
60
- - - "~>"
62
+ - - ">="
61
63
  - !ruby/object:Gem::Version
62
- version: 0.9.0
64
+ version: '0'
63
65
  type: :development
64
66
  prerelease: false
65
67
  version_requirements: !ruby/object:Gem::Requirement
66
68
  requirements:
67
- - - "~>"
69
+ - - ">="
68
70
  - !ruby/object:Gem::Version
69
- version: 0.9.0
71
+ version: '0'
70
72
  - !ruby/object:Gem::Dependency
71
- name: factory_girl
73
+ name: database_cleaner
72
74
  requirement: !ruby/object:Gem::Requirement
73
75
  requirements:
74
76
  - - "~>"
75
77
  - !ruby/object:Gem::Version
76
- version: 4.5.0
78
+ version: '1.6'
77
79
  type: :development
78
80
  prerelease: false
79
81
  version_requirements: !ruby/object:Gem::Requirement
80
82
  requirements:
81
83
  - - "~>"
82
84
  - !ruby/object:Gem::Version
83
- version: 4.5.0
85
+ version: '1.6'
84
86
  - !ruby/object:Gem::Dependency
85
- name: timecop
87
+ name: factory_bot
86
88
  requirement: !ruby/object:Gem::Requirement
87
89
  requirements:
88
90
  - - "~>"
89
91
  - !ruby/object:Gem::Version
90
- version: 0.7.0
92
+ version: '4.8'
91
93
  type: :development
92
94
  prerelease: false
93
95
  version_requirements: !ruby/object:Gem::Requirement
94
96
  requirements:
95
97
  - - "~>"
96
98
  - !ruby/object:Gem::Version
97
- version: 0.7.0
99
+ version: '4.8'
98
100
  - !ruby/object:Gem::Dependency
99
- name: database_cleaner
101
+ name: generator_spec
100
102
  requirement: !ruby/object:Gem::Requirement
101
103
  requirements:
102
104
  - - "~>"
103
105
  - !ruby/object:Gem::Version
104
- version: 1.3.0
106
+ version: 0.9.3
105
107
  type: :development
106
108
  prerelease: false
107
109
  version_requirements: !ruby/object:Gem::Requirement
108
110
  requirements:
109
111
  - - "~>"
110
112
  - !ruby/object:Gem::Version
111
- version: 1.3.0
113
+ version: 0.9.3
114
+ - !ruby/object:Gem::Dependency
115
+ name: rake
116
+ requirement: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 11.3.0
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: 11.3.0
128
+ - !ruby/object:Gem::Dependency
129
+ name: rspec-rails
130
+ requirement: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ type: :development
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
112
142
  description: Doorkeeper is an OAuth 2 provider for Rails and Grape.
113
143
  email:
114
- - tutecosta@gmail.com
144
+ - bulaj.nikita@gmail.com
115
145
  executables: []
116
146
  extensions: []
117
147
  extra_rdoc_files: []
118
148
  files:
149
+ - ".coveralls.yml"
150
+ - ".github/ISSUE_TEMPLATE.md"
151
+ - ".github/PULL_REQUEST_TEMPLATE.md"
119
152
  - ".gitignore"
120
153
  - ".hound.yml"
121
154
  - ".rspec"
155
+ - ".rubocop.yml"
122
156
  - ".travis.yml"
157
+ - Appraisals
158
+ - CODE_OF_CONDUCT.md
123
159
  - CONTRIBUTING.md
124
160
  - Gemfile
125
161
  - MIT-LICENSE
@@ -127,6 +163,7 @@ files:
127
163
  - README.md
128
164
  - RELEASING.md
129
165
  - Rakefile
166
+ - SECURITY.md
130
167
  - app/assets/stylesheets/doorkeeper/admin/application.css
131
168
  - app/assets/stylesheets/doorkeeper/application.css
132
169
  - app/controllers/doorkeeper/application_controller.rb
@@ -153,6 +190,11 @@ files:
153
190
  - app/views/layouts/doorkeeper/application.html.erb
154
191
  - config/locales/en.yml
155
192
  - doorkeeper.gemspec
193
+ - gemfiles/rails_4_2.gemfile
194
+ - gemfiles/rails_5_0.gemfile
195
+ - gemfiles/rails_5_1.gemfile
196
+ - gemfiles/rails_5_2.gemfile
197
+ - gemfiles/rails_master.gemfile
156
198
  - lib/doorkeeper.rb
157
199
  - lib/doorkeeper/config.rb
158
200
  - lib/doorkeeper/engine.rb
@@ -165,6 +207,7 @@ files:
165
207
  - lib/doorkeeper/models/application_mixin.rb
166
208
  - lib/doorkeeper/models/concerns/accessible.rb
167
209
  - lib/doorkeeper/models/concerns/expirable.rb
210
+ - lib/doorkeeper/models/concerns/orderable.rb
168
211
  - lib/doorkeeper/models/concerns/ownership.rb
169
212
  - lib/doorkeeper/models/concerns/revocable.rb
170
213
  - lib/doorkeeper/models/concerns/scopes.rb
@@ -172,9 +215,10 @@ files:
172
215
  - lib/doorkeeper/oauth/authorization/token.rb
173
216
  - lib/doorkeeper/oauth/authorization/uri_builder.rb
174
217
  - lib/doorkeeper/oauth/authorization_code_request.rb
218
+ - lib/doorkeeper/oauth/base_request.rb
219
+ - lib/doorkeeper/oauth/base_response.rb
175
220
  - lib/doorkeeper/oauth/client.rb
176
221
  - lib/doorkeeper/oauth/client/credentials.rb
177
- - lib/doorkeeper/oauth/client/methods.rb
178
222
  - lib/doorkeeper/oauth/client_credentials/creator.rb
179
223
  - lib/doorkeeper/oauth/client_credentials/issuer.rb
180
224
  - lib/doorkeeper/oauth/client_credentials/validation.rb
@@ -191,9 +235,9 @@ files:
191
235
  - lib/doorkeeper/oauth/password_access_token_request.rb
192
236
  - lib/doorkeeper/oauth/pre_authorization.rb
193
237
  - lib/doorkeeper/oauth/refresh_token_request.rb
194
- - lib/doorkeeper/oauth/request_concern.rb
195
238
  - lib/doorkeeper/oauth/scopes.rb
196
239
  - lib/doorkeeper/oauth/token.rb
240
+ - lib/doorkeeper/oauth/token_introspection.rb
197
241
  - lib/doorkeeper/oauth/token_request.rb
198
242
  - lib/doorkeeper/oauth/token_response.rb
199
243
  - lib/doorkeeper/orm/active_record.rb
@@ -215,16 +259,19 @@ files:
215
259
  - lib/doorkeeper/server.rb
216
260
  - lib/doorkeeper/validations.rb
217
261
  - lib/doorkeeper/version.rb
262
+ - lib/generators/doorkeeper/add_client_confidentiality_generator.rb
218
263
  - lib/generators/doorkeeper/application_owner_generator.rb
219
- - lib/generators/doorkeeper/application_scopes_generator.rb
220
264
  - lib/generators/doorkeeper/install_generator.rb
221
265
  - lib/generators/doorkeeper/migration_generator.rb
266
+ - lib/generators/doorkeeper/previous_refresh_token_generator.rb
222
267
  - lib/generators/doorkeeper/templates/README
223
- - lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb
224
- - lib/generators/doorkeeper/templates/add_scopes_to_oauth_applications.rb
268
+ - lib/generators/doorkeeper/templates/add_confidential_to_application_migration.rb.erb
269
+ - lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb.erb
270
+ - lib/generators/doorkeeper/templates/add_previous_refresh_token_to_access_tokens.rb.erb
225
271
  - lib/generators/doorkeeper/templates/initializer.rb
226
- - lib/generators/doorkeeper/templates/migration.rb
272
+ - lib/generators/doorkeeper/templates/migration.rb.erb
227
273
  - lib/generators/doorkeeper/views_generator.rb
274
+ - spec/controllers/application_metal_controller.rb
228
275
  - spec/controllers/applications_controller_spec.rb
229
276
  - spec/controllers/authorizations_controller_spec.rb
230
277
  - spec/controllers/protected_resources_controller_spec.rb
@@ -251,6 +298,7 @@ files:
251
298
  - spec/dummy/config/environments/test.rb
252
299
  - spec/dummy/config/initializers/backtrace_silencers.rb
253
300
  - spec/dummy/config/initializers/doorkeeper.rb
301
+ - spec/dummy/config/initializers/new_framework_defaults.rb
254
302
  - spec/dummy/config/initializers/secret_token.rb
255
303
  - spec/dummy/config/initializers/session_store.rb
256
304
  - spec/dummy/config/initializers/wrap_parameters.rb
@@ -258,9 +306,10 @@ files:
258
306
  - spec/dummy/config/routes.rb
259
307
  - spec/dummy/db/migrate/20111122132257_create_users.rb
260
308
  - spec/dummy/db/migrate/20120312140401_add_password_to_users.rb
261
- - spec/dummy/db/migrate/20130902165751_create_doorkeeper_tables.rb
262
- - spec/dummy/db/migrate/20130902175349_add_owner_to_application.rb
263
- - spec/dummy/db/migrate/20141209001746_add_scopes_to_oauth_applications.rb
309
+ - spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb
310
+ - spec/dummy/db/migrate/20151223200000_add_owner_to_application.rb
311
+ - spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb
312
+ - spec/dummy/db/migrate/20180210183654_add_confidential_to_application.rb
264
313
  - spec/dummy/db/schema.rb
265
314
  - spec/dummy/public/404.html
266
315
  - spec/dummy/public/422.html
@@ -271,8 +320,10 @@ files:
271
320
  - spec/generators/application_owner_generator_spec.rb
272
321
  - spec/generators/install_generator_spec.rb
273
322
  - spec/generators/migration_generator_spec.rb
323
+ - spec/generators/previous_refresh_token_generator_spec.rb
274
324
  - spec/generators/templates/routes.rb
275
325
  - spec/generators/views_generator_spec.rb
326
+ - spec/grape/grape_integration_spec.rb
276
327
  - spec/helpers/doorkeeper/dashboard_helper_spec.rb
277
328
  - spec/lib/config_spec.rb
278
329
  - spec/lib/doorkeeper_spec.rb
@@ -281,8 +332,9 @@ files:
281
332
  - spec/lib/models/scopes_spec.rb
282
333
  - spec/lib/oauth/authorization/uri_builder_spec.rb
283
334
  - spec/lib/oauth/authorization_code_request_spec.rb
335
+ - spec/lib/oauth/base_request_spec.rb
336
+ - spec/lib/oauth/base_response_spec.rb
284
337
  - spec/lib/oauth/client/credentials_spec.rb
285
- - spec/lib/oauth/client/methods_spec.rb
286
338
  - spec/lib/oauth/client_credentials/creator_spec.rb
287
339
  - spec/lib/oauth/client_credentials/issuer_spec.rb
288
340
  - spec/lib/oauth/client_credentials/validation_spec.rb
@@ -290,6 +342,7 @@ files:
290
342
  - spec/lib/oauth/client_credentials_request_spec.rb
291
343
  - spec/lib/oauth/client_spec.rb
292
344
  - spec/lib/oauth/code_request_spec.rb
345
+ - spec/lib/oauth/code_response_spec.rb
293
346
  - spec/lib/oauth/error_response_spec.rb
294
347
  - spec/lib/oauth/error_spec.rb
295
348
  - spec/lib/oauth/forbidden_token_response_spec.rb
@@ -336,16 +389,36 @@ files:
336
389
  - spec/support/helpers/model_helper.rb
337
390
  - spec/support/helpers/request_spec_helper.rb
338
391
  - spec/support/helpers/url_helper.rb
392
+ - spec/support/http_method_shim.rb
339
393
  - spec/support/orm/active_record.rb
340
394
  - spec/support/shared/controllers_shared_context.rb
341
395
  - spec/support/shared/models_shared_examples.rb
342
396
  - spec/validators/redirect_uri_validator_spec.rb
397
+ - spec/version/version_spec.rb
343
398
  - vendor/assets/stylesheets/doorkeeper/bootstrap.min.css
344
399
  homepage: https://github.com/doorkeeper-gem/doorkeeper
345
400
  licenses:
346
401
  - MIT
347
402
  metadata: {}
348
- post_install_message:
403
+ post_install_message: |2+
404
+
405
+
406
+ WARNING: This is a security release that addresses token revocation not working for public apps (CVE-2018-1000211)
407
+
408
+ There is no breaking change in this release, however to take advantage of the security fix you must:
409
+
410
+ 1. Run `rails generate doorkeeper:add_client_confidentiality` for the migration
411
+ 2. Review your OAuth apps and determine which ones exclusively use public grant flows (eg implicit)
412
+ 3. Update their `confidential` column to `false` for those public apps
413
+
414
+ This is a backported security release.
415
+
416
+ For more information:
417
+
418
+ * https://github.com/doorkeeper-gem/doorkeeper/pull/1119
419
+ * https://github.com/doorkeeper-gem/doorkeeper/issues/891
420
+
421
+
349
422
  rdoc_options: []
350
423
  require_paths:
351
424
  - lib
@@ -353,7 +426,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
353
426
  requirements:
354
427
  - - ">="
355
428
  - !ruby/object:Gem::Version
356
- version: '0'
429
+ version: '2.1'
357
430
  required_rubygems_version: !ruby/object:Gem::Requirement
358
431
  requirements:
359
432
  - - ">="
@@ -361,11 +434,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
361
434
  version: '0'
362
435
  requirements: []
363
436
  rubyforge_project:
364
- rubygems_version: 2.5.1
437
+ rubygems_version: 2.6.11
365
438
  signing_key:
366
439
  specification_version: 4
367
440
  summary: OAuth 2 provider for Rails and Grape
368
441
  test_files:
442
+ - spec/controllers/application_metal_controller.rb
369
443
  - spec/controllers/applications_controller_spec.rb
370
444
  - spec/controllers/authorizations_controller_spec.rb
371
445
  - spec/controllers/protected_resources_controller_spec.rb
@@ -392,6 +466,7 @@ test_files:
392
466
  - spec/dummy/config/environments/test.rb
393
467
  - spec/dummy/config/initializers/backtrace_silencers.rb
394
468
  - spec/dummy/config/initializers/doorkeeper.rb
469
+ - spec/dummy/config/initializers/new_framework_defaults.rb
395
470
  - spec/dummy/config/initializers/secret_token.rb
396
471
  - spec/dummy/config/initializers/session_store.rb
397
472
  - spec/dummy/config/initializers/wrap_parameters.rb
@@ -399,9 +474,10 @@ test_files:
399
474
  - spec/dummy/config/routes.rb
400
475
  - spec/dummy/db/migrate/20111122132257_create_users.rb
401
476
  - spec/dummy/db/migrate/20120312140401_add_password_to_users.rb
402
- - spec/dummy/db/migrate/20130902165751_create_doorkeeper_tables.rb
403
- - spec/dummy/db/migrate/20130902175349_add_owner_to_application.rb
404
- - spec/dummy/db/migrate/20141209001746_add_scopes_to_oauth_applications.rb
477
+ - spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb
478
+ - spec/dummy/db/migrate/20151223200000_add_owner_to_application.rb
479
+ - spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb
480
+ - spec/dummy/db/migrate/20180210183654_add_confidential_to_application.rb
405
481
  - spec/dummy/db/schema.rb
406
482
  - spec/dummy/public/404.html
407
483
  - spec/dummy/public/422.html
@@ -412,8 +488,10 @@ test_files:
412
488
  - spec/generators/application_owner_generator_spec.rb
413
489
  - spec/generators/install_generator_spec.rb
414
490
  - spec/generators/migration_generator_spec.rb
491
+ - spec/generators/previous_refresh_token_generator_spec.rb
415
492
  - spec/generators/templates/routes.rb
416
493
  - spec/generators/views_generator_spec.rb
494
+ - spec/grape/grape_integration_spec.rb
417
495
  - spec/helpers/doorkeeper/dashboard_helper_spec.rb
418
496
  - spec/lib/config_spec.rb
419
497
  - spec/lib/doorkeeper_spec.rb
@@ -422,8 +500,9 @@ test_files:
422
500
  - spec/lib/models/scopes_spec.rb
423
501
  - spec/lib/oauth/authorization/uri_builder_spec.rb
424
502
  - spec/lib/oauth/authorization_code_request_spec.rb
503
+ - spec/lib/oauth/base_request_spec.rb
504
+ - spec/lib/oauth/base_response_spec.rb
425
505
  - spec/lib/oauth/client/credentials_spec.rb
426
- - spec/lib/oauth/client/methods_spec.rb
427
506
  - spec/lib/oauth/client_credentials/creator_spec.rb
428
507
  - spec/lib/oauth/client_credentials/issuer_spec.rb
429
508
  - spec/lib/oauth/client_credentials/validation_spec.rb
@@ -431,6 +510,7 @@ test_files:
431
510
  - spec/lib/oauth/client_credentials_request_spec.rb
432
511
  - spec/lib/oauth/client_spec.rb
433
512
  - spec/lib/oauth/code_request_spec.rb
513
+ - spec/lib/oauth/code_response_spec.rb
434
514
  - spec/lib/oauth/error_response_spec.rb
435
515
  - spec/lib/oauth/error_spec.rb
436
516
  - spec/lib/oauth/forbidden_token_response_spec.rb
@@ -477,7 +557,9 @@ test_files:
477
557
  - spec/support/helpers/model_helper.rb
478
558
  - spec/support/helpers/request_spec_helper.rb
479
559
  - spec/support/helpers/url_helper.rb
560
+ - spec/support/http_method_shim.rb
480
561
  - spec/support/orm/active_record.rb
481
562
  - spec/support/shared/controllers_shared_context.rb
482
563
  - spec/support/shared/models_shared_examples.rb
483
564
  - spec/validators/redirect_uri_validator_spec.rb
565
+ - spec/version/version_spec.rb
@@ -1,18 +0,0 @@
1
- module Doorkeeper
2
- module OAuth
3
- class Client
4
- module Methods
5
- def from_params(request)
6
- request.parameters.values_at(:client_id, :client_secret)
7
- end
8
-
9
- def from_basic(request)
10
- authorization = request.authorization
11
- if authorization.present? && authorization =~ /^Basic (.*)/m
12
- Base64.decode64($1).split(/:/, 2)
13
- end
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,34 +0,0 @@
1
- require 'rails/generators/active_record'
2
-
3
- class Doorkeeper::ApplicationScopesGenerator < Rails::Generators::Base
4
- include Rails::Generators::Migration
5
- source_root File.expand_path('../templates', __FILE__)
6
- desc 'Copies ActiveRecord migrations to handle upgrade to doorkeeper 2'
7
-
8
- def self.next_migration_number(path)
9
- ActiveRecord::Generators::Base.next_migration_number(path)
10
- end
11
-
12
- def application_scopes
13
- if oauth_applications_exists? && !scopes_column_exists?
14
- migration_template(
15
- 'add_scopes_to_oauth_applications.rb',
16
- 'db/migrate/add_scopes_to_oauth_applications.rb'
17
- )
18
- end
19
- end
20
-
21
- private
22
-
23
- def scopes_column_exists?
24
- ActiveRecord::Base.connection.column_exists?(
25
- :oauth_applications,
26
- :scopes
27
- )
28
- end
29
-
30
- # Might be running this before install
31
- def oauth_applications_exists?
32
- ActiveRecord::Base.connection.table_exists? :oauth_applications
33
- end
34
- end
@@ -1,5 +0,0 @@
1
- class AddScopesToOauthApplications < ActiveRecord::Migration
2
- def change
3
- add_column :oauth_applications, :scopes, :string, null: false, default: ''
4
- end
5
- end
@@ -1,41 +0,0 @@
1
- class CreateDoorkeeperTables < ActiveRecord::Migration
2
- def change
3
- create_table :oauth_applications do |t|
4
- t.string :name, null: false
5
- t.string :uid, null: false
6
- t.string :secret, null: false
7
- t.string :redirect_uri, null: false, limit: 2048
8
- t.timestamps
9
- end
10
-
11
- add_index :oauth_applications, :uid, unique: true
12
-
13
- create_table :oauth_access_grants do |t|
14
- t.integer :resource_owner_id, null: false
15
- t.integer :application_id, null: false
16
- t.string :token, null: false
17
- t.integer :expires_in, null: false
18
- t.string :redirect_uri, null: false, limit: 2048
19
- t.datetime :created_at, null: false
20
- t.datetime :revoked_at
21
- t.string :scopes
22
- end
23
-
24
- add_index :oauth_access_grants, :token, unique: true
25
-
26
- create_table :oauth_access_tokens do |t|
27
- t.integer :resource_owner_id
28
- t.integer :application_id
29
- t.string :token, null: false
30
- t.string :refresh_token
31
- t.integer :expires_in
32
- t.datetime :revoked_at
33
- t.datetime :created_at, null: false
34
- t.string :scopes
35
- end
36
-
37
- add_index :oauth_access_tokens, :token, unique: true
38
- add_index :oauth_access_tokens, :resource_owner_id
39
- add_index :oauth_access_tokens, :refresh_token, unique: true
40
- end
41
- end
@@ -1,5 +0,0 @@
1
- class AddScopesToOauthApplications < ActiveRecord::Migration
2
- def change
3
- add_column :oauth_applications, :scopes, :string, null: false, default: ''
4
- end
5
- end