doorkeeper 3.1.0 → 4.2.6

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 (137) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +5 -0
  4. data/.travis.yml +16 -12
  5. data/Appraisals +14 -0
  6. data/CONTRIBUTING.md +2 -0
  7. data/Gemfile +5 -5
  8. data/NEWS.md +83 -2
  9. data/README.md +73 -43
  10. data/RELEASING.md +5 -12
  11. data/Rakefile +1 -1
  12. data/app/controllers/doorkeeper/application_controller.rb +3 -1
  13. data/app/controllers/doorkeeper/application_metal_controller.rb +3 -2
  14. data/app/controllers/doorkeeper/applications_controller.rb +3 -7
  15. data/app/controllers/doorkeeper/authorizations_controller.rb +1 -1
  16. data/app/controllers/doorkeeper/authorized_applications_controller.rb +1 -1
  17. data/app/controllers/doorkeeper/tokens_controller.rb +50 -14
  18. data/app/helpers/doorkeeper/dashboard_helper.rb +13 -11
  19. data/app/views/doorkeeper/applications/_delete_form.html.erb +1 -2
  20. data/app/views/doorkeeper/applications/_form.html.erb +1 -1
  21. data/app/views/doorkeeper/applications/show.html.erb +1 -1
  22. data/app/views/doorkeeper/authorizations/new.html.erb +1 -1
  23. data/app/views/doorkeeper/authorized_applications/_delete_form.html.erb +1 -2
  24. data/app/views/layouts/doorkeeper/admin.html.erb +1 -1
  25. data/config/locales/en.yml +3 -2
  26. data/doorkeeper.gemspec +12 -10
  27. data/gemfiles/rails_4_2.gemfile +11 -0
  28. data/gemfiles/rails_5_0.gemfile +12 -0
  29. data/gemfiles/rails_5_1.gemfile +13 -0
  30. data/lib/doorkeeper/config.rb +73 -16
  31. data/lib/doorkeeper/engine.rb +11 -7
  32. data/lib/doorkeeper/errors.rb +18 -0
  33. data/lib/doorkeeper/grape/helpers.rb +2 -1
  34. data/lib/doorkeeper/helpers/controller.rb +8 -23
  35. data/lib/doorkeeper/models/access_grant_mixin.rb +21 -5
  36. data/lib/doorkeeper/models/access_token_mixin.rb +145 -23
  37. data/lib/doorkeeper/models/application_mixin.rb +21 -9
  38. data/lib/doorkeeper/models/concerns/accessible.rb +4 -0
  39. data/lib/doorkeeper/models/concerns/expirable.rb +10 -2
  40. data/lib/doorkeeper/models/concerns/ownership.rb +6 -1
  41. data/lib/doorkeeper/models/concerns/revocable.rb +37 -2
  42. data/lib/doorkeeper/oauth/authorization/uri_builder.rb +20 -18
  43. data/lib/doorkeeper/oauth/authorization_code_request.rb +1 -4
  44. data/lib/doorkeeper/oauth/{request_concern.rb → base_request.rb} +3 -1
  45. data/lib/doorkeeper/oauth/base_response.rb +29 -0
  46. data/lib/doorkeeper/oauth/client/credentials.rb +17 -6
  47. data/lib/doorkeeper/oauth/client.rb +0 -1
  48. data/lib/doorkeeper/oauth/client_credentials/creator.rb +1 -1
  49. data/lib/doorkeeper/oauth/client_credentials/issuer.rb +3 -2
  50. data/lib/doorkeeper/oauth/client_credentials/validation.rb +1 -1
  51. data/lib/doorkeeper/oauth/client_credentials_request.rb +8 -8
  52. data/lib/doorkeeper/oauth/code_response.rb +16 -16
  53. data/lib/doorkeeper/oauth/error_response.rb +9 -8
  54. data/lib/doorkeeper/oauth/helpers/scope_checker.rb +1 -1
  55. data/lib/doorkeeper/oauth/helpers/uri_checker.rb +2 -1
  56. data/lib/doorkeeper/oauth/invalid_token_response.rb +2 -0
  57. data/lib/doorkeeper/oauth/password_access_token_request.rb +7 -13
  58. data/lib/doorkeeper/oauth/refresh_token_request.rb +22 -14
  59. data/lib/doorkeeper/oauth/scopes.rb +2 -2
  60. data/lib/doorkeeper/oauth/token.rb +20 -21
  61. data/lib/doorkeeper/oauth/token_request.rb +1 -2
  62. data/lib/doorkeeper/oauth/token_response.rb +1 -1
  63. data/lib/doorkeeper/orm/active_record/access_token.rb +25 -0
  64. data/lib/doorkeeper/orm/active_record/application.rb +12 -12
  65. data/lib/doorkeeper/orm/active_record.rb +0 -16
  66. data/lib/doorkeeper/rails/helpers.rb +1 -3
  67. data/lib/doorkeeper/rails/routes/mapper.rb +4 -4
  68. data/lib/doorkeeper/rails/routes/mapping.rb +1 -1
  69. data/lib/doorkeeper/rails/routes.rb +4 -4
  70. data/lib/doorkeeper/request/authorization_code.rb +7 -1
  71. data/lib/doorkeeper/request/password.rb +11 -1
  72. data/lib/doorkeeper/request/refresh_token.rb +1 -1
  73. data/lib/doorkeeper/server.rb +0 -8
  74. data/lib/doorkeeper/version.rb +1 -1
  75. data/lib/doorkeeper.rb +8 -2
  76. data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +29 -0
  77. data/lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb +1 -1
  78. data/lib/generators/doorkeeper/templates/add_previous_refresh_token_to_access_tokens.rb +11 -0
  79. data/lib/generators/doorkeeper/templates/initializer.rb +8 -3
  80. data/lib/generators/doorkeeper/templates/migration.rb +23 -5
  81. data/spec/controllers/application_metal_controller.rb +10 -0
  82. data/spec/controllers/authorizations_controller_spec.rb +39 -24
  83. data/spec/controllers/protected_resources_controller_spec.rb +47 -18
  84. data/spec/controllers/tokens_controller_spec.rb +1 -1
  85. data/spec/dummy/app/controllers/full_protected_resources_controller.rb +4 -4
  86. data/spec/dummy/app/controllers/home_controller.rb +1 -1
  87. data/spec/dummy/app/controllers/metal_controller.rb +1 -1
  88. data/spec/dummy/app/controllers/semi_protected_resources_controller.rb +3 -3
  89. data/spec/dummy/app/models/user.rb +0 -4
  90. data/spec/dummy/config/application.rb +2 -36
  91. data/spec/dummy/config/environment.rb +1 -1
  92. data/spec/dummy/config/environments/test.rb +4 -15
  93. data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +6 -0
  94. data/spec/dummy/config/initializers/doorkeeper.rb +2 -2
  95. data/spec/dummy/db/migrate/{20130902165751_create_doorkeeper_tables.rb → 20151223192035_create_doorkeeper_tables.rb} +24 -5
  96. data/spec/dummy/db/migrate/{20130902175349_add_owner_to_application.rb → 20151223200000_add_owner_to_application.rb} +0 -0
  97. data/spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb +11 -0
  98. data/spec/dummy/db/schema.rb +23 -22
  99. data/spec/factories.rb +3 -1
  100. data/spec/lib/config_spec.rb +19 -2
  101. data/spec/lib/doorkeeper_spec.rb +135 -13
  102. data/spec/lib/models/expirable_spec.rb +0 -1
  103. data/spec/lib/models/revocable_spec.rb +27 -4
  104. data/spec/lib/oauth/authorization/uri_builder_spec.rb +1 -2
  105. data/spec/lib/oauth/authorization_code_request_spec.rb +1 -1
  106. data/spec/lib/oauth/base_request_spec.rb +160 -0
  107. data/spec/lib/oauth/base_response_spec.rb +45 -0
  108. data/spec/lib/oauth/client/credentials_spec.rb +41 -0
  109. data/spec/lib/oauth/code_response_spec.rb +34 -0
  110. data/spec/lib/oauth/error_response_spec.rb +9 -9
  111. data/spec/lib/oauth/invalid_token_response_spec.rb +36 -8
  112. data/spec/lib/oauth/password_access_token_request_spec.rb +5 -5
  113. data/spec/lib/oauth/refresh_token_request_spec.rb +34 -3
  114. data/spec/lib/oauth/scopes_spec.rb +0 -1
  115. data/spec/lib/oauth/token_spec.rb +12 -5
  116. data/spec/lib/server_spec.rb +0 -3
  117. data/spec/models/doorkeeper/access_token_spec.rb +45 -1
  118. data/spec/models/doorkeeper/application_spec.rb +3 -11
  119. data/spec/requests/endpoints/authorization_spec.rb +5 -6
  120. data/spec/requests/flows/authorization_code_errors_spec.rb +11 -1
  121. data/spec/requests/flows/authorization_code_spec.rb +4 -12
  122. data/spec/requests/flows/password_spec.rb +26 -5
  123. data/spec/requests/flows/refresh_token_spec.rb +87 -17
  124. data/spec/requests/flows/revoke_token_spec.rb +100 -86
  125. data/spec/spec_helper.rb +2 -0
  126. data/spec/spec_helper_integration.rb +8 -1
  127. data/spec/support/helpers/model_helper.rb +27 -5
  128. data/spec/support/helpers/request_spec_helper.rb +12 -4
  129. data/spec/support/http_method_shim.rb +38 -0
  130. data/spec/support/shared/controllers_shared_context.rb +13 -4
  131. data/spec/support/shared/models_shared_examples.rb +1 -1
  132. metadata +72 -42
  133. data/lib/doorkeeper/oauth/client/methods.rb +0 -18
  134. data/lib/generators/doorkeeper/application_scopes_generator.rb +0 -34
  135. data/lib/generators/doorkeeper/templates/add_scopes_to_oauth_applications.rb +0 -5
  136. data/spec/dummy/db/migrate/20141209001746_add_scopes_to_oauth_applications.rb +0 -5
  137. data/spec/lib/oauth/client/methods_spec.rb +0 -54
metadata CHANGED
@@ -1,15 +1,16 @@
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.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Elias Philipp
8
8
  - Tute Costa
9
+ - Jon Moss
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2015-12-23 00:00:00.000000000 Z
13
+ date: 2017-05-26 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: railties
@@ -17,109 +18,125 @@ dependencies:
17
18
  requirements:
18
19
  - - ">="
19
20
  - !ruby/object:Gem::Version
20
- version: '3.2'
21
+ version: '4.2'
21
22
  type: :runtime
22
23
  prerelease: false
23
24
  version_requirements: !ruby/object:Gem::Requirement
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
27
- version: '3.2'
28
+ version: '4.2'
28
29
  - !ruby/object:Gem::Dependency
29
- name: rspec-rails
30
+ name: capybara
30
31
  requirement: !ruby/object:Gem::Requirement
31
32
  requirements:
32
- - - "~>"
33
+ - - ">="
33
34
  - !ruby/object:Gem::Version
34
- version: 3.4.0
35
+ version: '0'
35
36
  type: :development
36
37
  prerelease: false
37
38
  version_requirements: !ruby/object:Gem::Requirement
38
39
  requirements:
39
- - - "~>"
40
+ - - ">="
40
41
  - !ruby/object:Gem::Version
41
- version: 3.4.0
42
+ version: '0'
42
43
  - !ruby/object:Gem::Dependency
43
- name: capybara
44
+ name: coveralls
44
45
  requirement: !ruby/object:Gem::Requirement
45
46
  requirements:
46
- - - "~>"
47
+ - - ">="
47
48
  - !ruby/object:Gem::Version
48
- version: 2.3.0
49
+ version: '0'
49
50
  type: :development
50
51
  prerelease: false
51
52
  version_requirements: !ruby/object:Gem::Requirement
52
53
  requirements:
53
- - - "~>"
54
+ - - ">="
54
55
  - !ruby/object:Gem::Version
55
- version: 2.3.0
56
+ version: '0'
56
57
  - !ruby/object:Gem::Dependency
57
- name: generator_spec
58
+ name: database_cleaner
58
59
  requirement: !ruby/object:Gem::Requirement
59
60
  requirements:
60
61
  - - "~>"
61
62
  - !ruby/object:Gem::Version
62
- version: 0.9.0
63
+ version: 1.5.3
63
64
  type: :development
64
65
  prerelease: false
65
66
  version_requirements: !ruby/object:Gem::Requirement
66
67
  requirements:
67
68
  - - "~>"
68
69
  - !ruby/object:Gem::Version
69
- version: 0.9.0
70
+ version: 1.5.3
70
71
  - !ruby/object:Gem::Dependency
71
72
  name: factory_girl
72
73
  requirement: !ruby/object:Gem::Requirement
73
74
  requirements:
74
75
  - - "~>"
75
76
  - !ruby/object:Gem::Version
76
- version: 4.5.0
77
+ version: 4.7.0
77
78
  type: :development
78
79
  prerelease: false
79
80
  version_requirements: !ruby/object:Gem::Requirement
80
81
  requirements:
81
82
  - - "~>"
82
83
  - !ruby/object:Gem::Version
83
- version: 4.5.0
84
+ version: 4.7.0
84
85
  - !ruby/object:Gem::Dependency
85
- name: timecop
86
+ name: generator_spec
86
87
  requirement: !ruby/object:Gem::Requirement
87
88
  requirements:
88
89
  - - "~>"
89
90
  - !ruby/object:Gem::Version
90
- version: 0.7.0
91
+ version: 0.9.3
91
92
  type: :development
92
93
  prerelease: false
93
94
  version_requirements: !ruby/object:Gem::Requirement
94
95
  requirements:
95
96
  - - "~>"
96
97
  - !ruby/object:Gem::Version
97
- version: 0.7.0
98
+ version: 0.9.3
98
99
  - !ruby/object:Gem::Dependency
99
- name: database_cleaner
100
+ name: rake
100
101
  requirement: !ruby/object:Gem::Requirement
101
102
  requirements:
102
- - - "~>"
103
+ - - ">="
103
104
  - !ruby/object:Gem::Version
104
- version: 1.3.0
105
+ version: 11.3.0
105
106
  type: :development
106
107
  prerelease: false
107
108
  version_requirements: !ruby/object:Gem::Requirement
108
109
  requirements:
109
- - - "~>"
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 11.3.0
113
+ - !ruby/object:Gem::Dependency
114
+ name: rspec-rails
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
110
125
  - !ruby/object:Gem::Version
111
- version: 1.3.0
126
+ version: '0'
112
127
  description: Doorkeeper is an OAuth 2 provider for Rails and Grape.
113
128
  email:
114
- - tutecosta@gmail.com
129
+ - me@jonathanmoss.me
115
130
  executables: []
116
131
  extensions: []
117
132
  extra_rdoc_files: []
118
133
  files:
134
+ - ".coveralls.yml"
119
135
  - ".gitignore"
120
136
  - ".hound.yml"
121
137
  - ".rspec"
122
138
  - ".travis.yml"
139
+ - Appraisals
123
140
  - CONTRIBUTING.md
124
141
  - Gemfile
125
142
  - MIT-LICENSE
@@ -153,6 +170,9 @@ files:
153
170
  - app/views/layouts/doorkeeper/application.html.erb
154
171
  - config/locales/en.yml
155
172
  - doorkeeper.gemspec
173
+ - gemfiles/rails_4_2.gemfile
174
+ - gemfiles/rails_5_0.gemfile
175
+ - gemfiles/rails_5_1.gemfile
156
176
  - lib/doorkeeper.rb
157
177
  - lib/doorkeeper/config.rb
158
178
  - lib/doorkeeper/engine.rb
@@ -172,9 +192,10 @@ files:
172
192
  - lib/doorkeeper/oauth/authorization/token.rb
173
193
  - lib/doorkeeper/oauth/authorization/uri_builder.rb
174
194
  - lib/doorkeeper/oauth/authorization_code_request.rb
195
+ - lib/doorkeeper/oauth/base_request.rb
196
+ - lib/doorkeeper/oauth/base_response.rb
175
197
  - lib/doorkeeper/oauth/client.rb
176
198
  - lib/doorkeeper/oauth/client/credentials.rb
177
- - lib/doorkeeper/oauth/client/methods.rb
178
199
  - lib/doorkeeper/oauth/client_credentials/creator.rb
179
200
  - lib/doorkeeper/oauth/client_credentials/issuer.rb
180
201
  - lib/doorkeeper/oauth/client_credentials/validation.rb
@@ -191,7 +212,6 @@ files:
191
212
  - lib/doorkeeper/oauth/password_access_token_request.rb
192
213
  - lib/doorkeeper/oauth/pre_authorization.rb
193
214
  - lib/doorkeeper/oauth/refresh_token_request.rb
194
- - lib/doorkeeper/oauth/request_concern.rb
195
215
  - lib/doorkeeper/oauth/scopes.rb
196
216
  - lib/doorkeeper/oauth/token.rb
197
217
  - lib/doorkeeper/oauth/token_request.rb
@@ -216,15 +236,16 @@ files:
216
236
  - lib/doorkeeper/validations.rb
217
237
  - lib/doorkeeper/version.rb
218
238
  - lib/generators/doorkeeper/application_owner_generator.rb
219
- - lib/generators/doorkeeper/application_scopes_generator.rb
220
239
  - lib/generators/doorkeeper/install_generator.rb
221
240
  - lib/generators/doorkeeper/migration_generator.rb
241
+ - lib/generators/doorkeeper/previous_refresh_token_generator.rb
222
242
  - lib/generators/doorkeeper/templates/README
223
243
  - lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb
224
- - lib/generators/doorkeeper/templates/add_scopes_to_oauth_applications.rb
244
+ - lib/generators/doorkeeper/templates/add_previous_refresh_token_to_access_tokens.rb
225
245
  - lib/generators/doorkeeper/templates/initializer.rb
226
246
  - lib/generators/doorkeeper/templates/migration.rb
227
247
  - lib/generators/doorkeeper/views_generator.rb
248
+ - spec/controllers/application_metal_controller.rb
228
249
  - spec/controllers/applications_controller_spec.rb
229
250
  - spec/controllers/authorizations_controller_spec.rb
230
251
  - spec/controllers/protected_resources_controller_spec.rb
@@ -249,6 +270,7 @@ files:
249
270
  - spec/dummy/config/environments/development.rb
250
271
  - spec/dummy/config/environments/production.rb
251
272
  - spec/dummy/config/environments/test.rb
273
+ - spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb
252
274
  - spec/dummy/config/initializers/backtrace_silencers.rb
253
275
  - spec/dummy/config/initializers/doorkeeper.rb
254
276
  - spec/dummy/config/initializers/secret_token.rb
@@ -258,9 +280,9 @@ files:
258
280
  - spec/dummy/config/routes.rb
259
281
  - spec/dummy/db/migrate/20111122132257_create_users.rb
260
282
  - 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
283
+ - spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb
284
+ - spec/dummy/db/migrate/20151223200000_add_owner_to_application.rb
285
+ - spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb
264
286
  - spec/dummy/db/schema.rb
265
287
  - spec/dummy/public/404.html
266
288
  - spec/dummy/public/422.html
@@ -281,8 +303,9 @@ files:
281
303
  - spec/lib/models/scopes_spec.rb
282
304
  - spec/lib/oauth/authorization/uri_builder_spec.rb
283
305
  - spec/lib/oauth/authorization_code_request_spec.rb
306
+ - spec/lib/oauth/base_request_spec.rb
307
+ - spec/lib/oauth/base_response_spec.rb
284
308
  - spec/lib/oauth/client/credentials_spec.rb
285
- - spec/lib/oauth/client/methods_spec.rb
286
309
  - spec/lib/oauth/client_credentials/creator_spec.rb
287
310
  - spec/lib/oauth/client_credentials/issuer_spec.rb
288
311
  - spec/lib/oauth/client_credentials/validation_spec.rb
@@ -290,6 +313,7 @@ files:
290
313
  - spec/lib/oauth/client_credentials_request_spec.rb
291
314
  - spec/lib/oauth/client_spec.rb
292
315
  - spec/lib/oauth/code_request_spec.rb
316
+ - spec/lib/oauth/code_response_spec.rb
293
317
  - spec/lib/oauth/error_response_spec.rb
294
318
  - spec/lib/oauth/error_spec.rb
295
319
  - spec/lib/oauth/forbidden_token_response_spec.rb
@@ -336,6 +360,7 @@ files:
336
360
  - spec/support/helpers/model_helper.rb
337
361
  - spec/support/helpers/request_spec_helper.rb
338
362
  - spec/support/helpers/url_helper.rb
363
+ - spec/support/http_method_shim.rb
339
364
  - spec/support/orm/active_record.rb
340
365
  - spec/support/shared/controllers_shared_context.rb
341
366
  - spec/support/shared/models_shared_examples.rb
@@ -353,7 +378,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
353
378
  requirements:
354
379
  - - ">="
355
380
  - !ruby/object:Gem::Version
356
- version: '0'
381
+ version: '2.1'
357
382
  required_rubygems_version: !ruby/object:Gem::Requirement
358
383
  requirements:
359
384
  - - ">="
@@ -361,11 +386,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
361
386
  version: '0'
362
387
  requirements: []
363
388
  rubyforge_project:
364
- rubygems_version: 2.5.1
389
+ rubygems_version: 2.6.11
365
390
  signing_key:
366
391
  specification_version: 4
367
392
  summary: OAuth 2 provider for Rails and Grape
368
393
  test_files:
394
+ - spec/controllers/application_metal_controller.rb
369
395
  - spec/controllers/applications_controller_spec.rb
370
396
  - spec/controllers/authorizations_controller_spec.rb
371
397
  - spec/controllers/protected_resources_controller_spec.rb
@@ -390,6 +416,7 @@ test_files:
390
416
  - spec/dummy/config/environments/development.rb
391
417
  - spec/dummy/config/environments/production.rb
392
418
  - spec/dummy/config/environments/test.rb
419
+ - spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb
393
420
  - spec/dummy/config/initializers/backtrace_silencers.rb
394
421
  - spec/dummy/config/initializers/doorkeeper.rb
395
422
  - spec/dummy/config/initializers/secret_token.rb
@@ -399,9 +426,9 @@ test_files:
399
426
  - spec/dummy/config/routes.rb
400
427
  - spec/dummy/db/migrate/20111122132257_create_users.rb
401
428
  - 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
429
+ - spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb
430
+ - spec/dummy/db/migrate/20151223200000_add_owner_to_application.rb
431
+ - spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb
405
432
  - spec/dummy/db/schema.rb
406
433
  - spec/dummy/public/404.html
407
434
  - spec/dummy/public/422.html
@@ -422,8 +449,9 @@ test_files:
422
449
  - spec/lib/models/scopes_spec.rb
423
450
  - spec/lib/oauth/authorization/uri_builder_spec.rb
424
451
  - spec/lib/oauth/authorization_code_request_spec.rb
452
+ - spec/lib/oauth/base_request_spec.rb
453
+ - spec/lib/oauth/base_response_spec.rb
425
454
  - spec/lib/oauth/client/credentials_spec.rb
426
- - spec/lib/oauth/client/methods_spec.rb
427
455
  - spec/lib/oauth/client_credentials/creator_spec.rb
428
456
  - spec/lib/oauth/client_credentials/issuer_spec.rb
429
457
  - spec/lib/oauth/client_credentials/validation_spec.rb
@@ -431,6 +459,7 @@ test_files:
431
459
  - spec/lib/oauth/client_credentials_request_spec.rb
432
460
  - spec/lib/oauth/client_spec.rb
433
461
  - spec/lib/oauth/code_request_spec.rb
462
+ - spec/lib/oauth/code_response_spec.rb
434
463
  - spec/lib/oauth/error_response_spec.rb
435
464
  - spec/lib/oauth/error_spec.rb
436
465
  - spec/lib/oauth/forbidden_token_response_spec.rb
@@ -477,6 +506,7 @@ test_files:
477
506
  - spec/support/helpers/model_helper.rb
478
507
  - spec/support/helpers/request_spec_helper.rb
479
508
  - spec/support/helpers/url_helper.rb
509
+ - spec/support/http_method_shim.rb
480
510
  - spec/support/orm/active_record.rb
481
511
  - spec/support/shared/controllers_shared_context.rb
482
512
  - spec/support/shared/models_shared_examples.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,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,54 +0,0 @@
1
- require 'spec_helper'
2
- require 'active_support/core_ext/string'
3
- require 'doorkeeper/oauth/client'
4
-
5
- class Doorkeeper::OAuth::Client
6
- describe 'Methods' do
7
- let(:client_id) { 'some-uid' }
8
- let(:client_secret) { 'some-secret' }
9
-
10
- subject do
11
- Class.new do
12
- include Methods
13
- end.new
14
- end
15
-
16
- describe :from_params do
17
- it 'returns credentials from parameters when Authorization header is not available' do
18
- request = double parameters: { client_id: client_id, client_secret: client_secret }
19
- uid, secret = subject.from_params(request)
20
-
21
- expect(uid).to eq('some-uid')
22
- expect(secret).to eq('some-secret')
23
- end
24
-
25
- it 'is blank when there are no credentials' do
26
- request = double parameters: {}
27
- uid, secret = subject.from_params(request)
28
-
29
- expect(uid).to be_blank
30
- expect(secret).to be_blank
31
- end
32
- end
33
-
34
- describe :from_basic do
35
- let(:credentials) { Base64.encode64("#{client_id}:#{client_secret}") }
36
-
37
- it 'decodes the credentials' do
38
- request = double authorization: "Basic #{credentials}"
39
- uid, secret = subject.from_basic(request)
40
-
41
- expect(uid).to eq('some-uid')
42
- expect(secret).to eq('some-secret')
43
- end
44
-
45
- it 'is blank if Authorization is not Basic' do
46
- request = double authorization: "#{credentials}"
47
- uid, secret = subject.from_basic(request)
48
-
49
- expect(uid).to be_blank
50
- expect(secret).to be_blank
51
- end
52
- end
53
- end
54
- end