doorkeeper 4.2.0 → 5.5.2

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 (271) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +1038 -0
  3. data/README.md +110 -348
  4. data/app/assets/stylesheets/doorkeeper/admin/application.css +2 -2
  5. data/app/controllers/doorkeeper/application_controller.rb +6 -7
  6. data/app/controllers/doorkeeper/application_metal_controller.rb +7 -11
  7. data/app/controllers/doorkeeper/applications_controller.rb +65 -20
  8. data/app/controllers/doorkeeper/authorizations_controller.rb +97 -17
  9. data/app/controllers/doorkeeper/authorized_applications_controller.rb +22 -3
  10. data/app/controllers/doorkeeper/token_info_controller.rb +16 -4
  11. data/app/controllers/doorkeeper/tokens_controller.rb +112 -35
  12. data/app/helpers/doorkeeper/dashboard_helper.rb +10 -6
  13. data/app/views/doorkeeper/applications/_delete_form.html.erb +4 -3
  14. data/app/views/doorkeeper/applications/_form.html.erb +33 -21
  15. data/app/views/doorkeeper/applications/edit.html.erb +1 -1
  16. data/app/views/doorkeeper/applications/index.html.erb +18 -6
  17. data/app/views/doorkeeper/applications/new.html.erb +1 -1
  18. data/app/views/doorkeeper/applications/show.html.erb +40 -16
  19. data/app/views/doorkeeper/authorizations/error.html.erb +1 -1
  20. data/app/views/doorkeeper/authorizations/form_post.html.erb +15 -0
  21. data/app/views/doorkeeper/authorizations/new.html.erb +7 -1
  22. data/app/views/doorkeeper/authorized_applications/_delete_form.html.erb +1 -2
  23. data/app/views/doorkeeper/authorized_applications/index.html.erb +0 -1
  24. data/app/views/layouts/doorkeeper/admin.html.erb +16 -14
  25. data/config/locales/en.yml +33 -9
  26. data/lib/doorkeeper/config/abstract_builder.rb +28 -0
  27. data/lib/doorkeeper/config/option.rb +82 -0
  28. data/lib/doorkeeper/config/validations.rb +53 -0
  29. data/lib/doorkeeper/config.rb +545 -143
  30. data/lib/doorkeeper/engine.rb +11 -5
  31. data/lib/doorkeeper/errors.rb +37 -10
  32. data/lib/doorkeeper/grant_flow/fallback_flow.rb +15 -0
  33. data/lib/doorkeeper/grant_flow/flow.rb +44 -0
  34. data/lib/doorkeeper/grant_flow/registry.rb +50 -0
  35. data/lib/doorkeeper/grant_flow.rb +45 -0
  36. data/lib/doorkeeper/grape/authorization_decorator.rb +6 -4
  37. data/lib/doorkeeper/grape/helpers.rb +24 -12
  38. data/lib/doorkeeper/helpers/controller.rb +49 -27
  39. data/lib/doorkeeper/models/access_grant_mixin.rb +100 -21
  40. data/lib/doorkeeper/models/access_token_mixin.rb +379 -75
  41. data/lib/doorkeeper/models/application_mixin.rb +72 -25
  42. data/lib/doorkeeper/models/concerns/accessible.rb +6 -0
  43. data/lib/doorkeeper/models/concerns/expirable.rb +20 -6
  44. data/lib/doorkeeper/models/concerns/orderable.rb +15 -0
  45. data/lib/doorkeeper/models/concerns/ownership.rb +4 -7
  46. data/lib/doorkeeper/models/concerns/resource_ownerable.rb +47 -0
  47. data/lib/doorkeeper/models/concerns/reusable.rb +19 -0
  48. data/lib/doorkeeper/models/concerns/revocable.rb +12 -18
  49. data/lib/doorkeeper/models/concerns/scopes.rb +12 -2
  50. data/lib/doorkeeper/models/concerns/secret_storable.rb +106 -0
  51. data/lib/doorkeeper/oauth/authorization/code.rb +48 -12
  52. data/lib/doorkeeper/oauth/authorization/context.rb +17 -0
  53. data/lib/doorkeeper/oauth/authorization/token.rb +66 -28
  54. data/lib/doorkeeper/oauth/authorization/uri_builder.rb +22 -18
  55. data/lib/doorkeeper/oauth/authorization_code_request.rb +64 -14
  56. data/lib/doorkeeper/oauth/base_request.rb +66 -0
  57. data/lib/doorkeeper/oauth/base_response.rb +31 -0
  58. data/lib/doorkeeper/oauth/client/credentials.rb +23 -10
  59. data/lib/doorkeeper/oauth/client.rb +10 -12
  60. data/lib/doorkeeper/oauth/client_credentials/creator.rb +47 -4
  61. data/lib/doorkeeper/oauth/client_credentials/issuer.rb +16 -9
  62. data/lib/doorkeeper/oauth/client_credentials/validator.rb +56 -0
  63. data/lib/doorkeeper/oauth/client_credentials_request.rb +11 -15
  64. data/lib/doorkeeper/oauth/code_request.rb +8 -12
  65. data/lib/doorkeeper/oauth/code_response.rb +28 -15
  66. data/lib/doorkeeper/oauth/error.rb +5 -3
  67. data/lib/doorkeeper/oauth/error_response.rb +41 -20
  68. data/lib/doorkeeper/oauth/forbidden_token_response.rb +10 -3
  69. data/lib/doorkeeper/oauth/helpers/scope_checker.rb +23 -18
  70. data/lib/doorkeeper/oauth/helpers/unique_token.rb +20 -3
  71. data/lib/doorkeeper/oauth/helpers/uri_checker.rb +53 -3
  72. data/lib/doorkeeper/oauth/hooks/context.rb +21 -0
  73. data/lib/doorkeeper/oauth/invalid_request_response.rb +43 -0
  74. data/lib/doorkeeper/oauth/invalid_token_response.rb +31 -5
  75. data/lib/doorkeeper/oauth/nonstandard.rb +39 -0
  76. data/lib/doorkeeper/oauth/password_access_token_request.rb +45 -13
  77. data/lib/doorkeeper/oauth/pre_authorization.rb +135 -26
  78. data/lib/doorkeeper/oauth/refresh_token_request.rb +61 -36
  79. data/lib/doorkeeper/oauth/scopes.rb +26 -12
  80. data/lib/doorkeeper/oauth/token.rb +25 -23
  81. data/lib/doorkeeper/oauth/token_introspection.rb +202 -0
  82. data/lib/doorkeeper/oauth/token_request.rb +8 -21
  83. data/lib/doorkeeper/oauth/token_response.rb +14 -10
  84. data/lib/doorkeeper/oauth.rb +13 -0
  85. data/lib/doorkeeper/orm/active_record/access_grant.rb +6 -4
  86. data/lib/doorkeeper/orm/active_record/access_token.rb +5 -25
  87. data/lib/doorkeeper/orm/active_record/application.rb +6 -15
  88. data/lib/doorkeeper/orm/active_record/mixins/access_grant.rb +68 -0
  89. data/lib/doorkeeper/orm/active_record/mixins/access_token.rb +59 -0
  90. data/lib/doorkeeper/orm/active_record/mixins/application.rb +198 -0
  91. data/lib/doorkeeper/orm/active_record/redirect_uri_validator.rb +66 -0
  92. data/lib/doorkeeper/orm/active_record/stale_records_cleaner.rb +33 -0
  93. data/lib/doorkeeper/orm/active_record.rb +37 -8
  94. data/lib/doorkeeper/rails/helpers.rb +14 -15
  95. data/lib/doorkeeper/rails/routes/abstract_router.rb +35 -0
  96. data/lib/doorkeeper/rails/routes/mapper.rb +3 -1
  97. data/lib/doorkeeper/rails/routes/mapping.rb +10 -8
  98. data/lib/doorkeeper/rails/routes/registry.rb +45 -0
  99. data/lib/doorkeeper/rails/routes.rb +42 -30
  100. data/lib/doorkeeper/rake/db.rake +40 -0
  101. data/lib/doorkeeper/rake/setup.rake +11 -0
  102. data/lib/doorkeeper/rake.rb +14 -0
  103. data/lib/doorkeeper/request/authorization_code.rb +12 -4
  104. data/lib/doorkeeper/request/client_credentials.rb +3 -3
  105. data/lib/doorkeeper/request/code.rb +1 -1
  106. data/lib/doorkeeper/request/password.rb +5 -14
  107. data/lib/doorkeeper/request/refresh_token.rb +6 -5
  108. data/lib/doorkeeper/request/strategy.rb +4 -2
  109. data/lib/doorkeeper/request/token.rb +1 -1
  110. data/lib/doorkeeper/request.rb +62 -29
  111. data/lib/doorkeeper/secret_storing/base.rb +64 -0
  112. data/lib/doorkeeper/secret_storing/bcrypt.rb +60 -0
  113. data/lib/doorkeeper/secret_storing/plain.rb +33 -0
  114. data/lib/doorkeeper/secret_storing/sha256_hash.rb +26 -0
  115. data/lib/doorkeeper/server.rb +9 -19
  116. data/lib/doorkeeper/stale_records_cleaner.rb +24 -0
  117. data/lib/doorkeeper/validations.rb +5 -2
  118. data/lib/doorkeeper/version.rb +12 -1
  119. data/lib/doorkeeper.rb +111 -56
  120. data/lib/generators/doorkeeper/application_owner_generator.rb +28 -13
  121. data/lib/generators/doorkeeper/confidential_applications_generator.rb +33 -0
  122. data/lib/generators/doorkeeper/enable_polymorphic_resource_owner_generator.rb +39 -0
  123. data/lib/generators/doorkeeper/install_generator.rb +19 -9
  124. data/lib/generators/doorkeeper/migration_generator.rb +27 -10
  125. data/lib/generators/doorkeeper/pkce_generator.rb +33 -0
  126. data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +31 -19
  127. data/lib/generators/doorkeeper/templates/add_confidential_to_applications.rb.erb +13 -0
  128. data/lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb.erb +9 -0
  129. data/lib/generators/doorkeeper/templates/{add_previous_refresh_token_to_access_tokens.rb → add_previous_refresh_token_to_access_tokens.rb.erb} +3 -1
  130. data/lib/generators/doorkeeper/templates/enable_pkce_migration.rb.erb +8 -0
  131. data/lib/generators/doorkeeper/templates/enable_polymorphic_resource_owner_migration.rb.erb +17 -0
  132. data/lib/generators/doorkeeper/templates/initializer.rb +410 -31
  133. data/lib/generators/doorkeeper/templates/migration.rb.erb +88 -0
  134. data/lib/generators/doorkeeper/views_generator.rb +8 -4
  135. data/vendor/assets/stylesheets/doorkeeper/bootstrap.min.css +4 -5
  136. metadata +132 -286
  137. data/.gitignore +0 -14
  138. data/.hound.yml +0 -13
  139. data/.rspec +0 -1
  140. data/.travis.yml +0 -20
  141. data/CONTRIBUTING.md +0 -47
  142. data/Gemfile +0 -14
  143. data/NEWS.md +0 -593
  144. data/RELEASING.md +0 -17
  145. data/Rakefile +0 -20
  146. data/app/validators/redirect_uri_validator.rb +0 -34
  147. data/doorkeeper.gemspec +0 -28
  148. data/lib/doorkeeper/oauth/client/methods.rb +0 -18
  149. data/lib/doorkeeper/oauth/client_credentials/validation.rb +0 -45
  150. data/lib/doorkeeper/oauth/request_concern.rb +0 -48
  151. data/lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb +0 -7
  152. data/lib/generators/doorkeeper/templates/migration.rb +0 -68
  153. data/spec/controllers/application_metal_controller.rb +0 -10
  154. data/spec/controllers/applications_controller_spec.rb +0 -58
  155. data/spec/controllers/authorizations_controller_spec.rb +0 -189
  156. data/spec/controllers/protected_resources_controller_spec.rb +0 -300
  157. data/spec/controllers/token_info_controller_spec.rb +0 -52
  158. data/spec/controllers/tokens_controller_spec.rb +0 -88
  159. data/spec/dummy/Rakefile +0 -7
  160. data/spec/dummy/app/controllers/application_controller.rb +0 -3
  161. data/spec/dummy/app/controllers/custom_authorizations_controller.rb +0 -7
  162. data/spec/dummy/app/controllers/full_protected_resources_controller.rb +0 -12
  163. data/spec/dummy/app/controllers/home_controller.rb +0 -17
  164. data/spec/dummy/app/controllers/metal_controller.rb +0 -11
  165. data/spec/dummy/app/controllers/semi_protected_resources_controller.rb +0 -11
  166. data/spec/dummy/app/helpers/application_helper.rb +0 -5
  167. data/spec/dummy/app/models/user.rb +0 -5
  168. data/spec/dummy/app/views/home/index.html.erb +0 -0
  169. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  170. data/spec/dummy/config/application.rb +0 -23
  171. data/spec/dummy/config/boot.rb +0 -9
  172. data/spec/dummy/config/database.yml +0 -15
  173. data/spec/dummy/config/environment.rb +0 -5
  174. data/spec/dummy/config/environments/development.rb +0 -29
  175. data/spec/dummy/config/environments/production.rb +0 -62
  176. data/spec/dummy/config/environments/test.rb +0 -44
  177. data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +0 -6
  178. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  179. data/spec/dummy/config/initializers/doorkeeper.rb +0 -96
  180. data/spec/dummy/config/initializers/secret_token.rb +0 -9
  181. data/spec/dummy/config/initializers/session_store.rb +0 -8
  182. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  183. data/spec/dummy/config/locales/doorkeeper.en.yml +0 -5
  184. data/spec/dummy/config/routes.rb +0 -52
  185. data/spec/dummy/config.ru +0 -4
  186. data/spec/dummy/db/migrate/20111122132257_create_users.rb +0 -9
  187. data/spec/dummy/db/migrate/20120312140401_add_password_to_users.rb +0 -5
  188. data/spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb +0 -60
  189. data/spec/dummy/db/migrate/20151223200000_add_owner_to_application.rb +0 -7
  190. data/spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb +0 -11
  191. data/spec/dummy/db/schema.rb +0 -67
  192. data/spec/dummy/public/404.html +0 -26
  193. data/spec/dummy/public/422.html +0 -26
  194. data/spec/dummy/public/500.html +0 -26
  195. data/spec/dummy/public/favicon.ico +0 -0
  196. data/spec/dummy/script/rails +0 -6
  197. data/spec/factories.rb +0 -28
  198. data/spec/generators/application_owner_generator_spec.rb +0 -22
  199. data/spec/generators/install_generator_spec.rb +0 -31
  200. data/spec/generators/migration_generator_spec.rb +0 -20
  201. data/spec/generators/templates/routes.rb +0 -3
  202. data/spec/generators/views_generator_spec.rb +0 -27
  203. data/spec/helpers/doorkeeper/dashboard_helper_spec.rb +0 -24
  204. data/spec/lib/config_spec.rb +0 -334
  205. data/spec/lib/doorkeeper_spec.rb +0 -28
  206. data/spec/lib/models/expirable_spec.rb +0 -51
  207. data/spec/lib/models/revocable_spec.rb +0 -59
  208. data/spec/lib/models/scopes_spec.rb +0 -43
  209. data/spec/lib/oauth/authorization/uri_builder_spec.rb +0 -42
  210. data/spec/lib/oauth/authorization_code_request_spec.rb +0 -80
  211. data/spec/lib/oauth/client/credentials_spec.rb +0 -47
  212. data/spec/lib/oauth/client/methods_spec.rb +0 -54
  213. data/spec/lib/oauth/client_credentials/creator_spec.rb +0 -44
  214. data/spec/lib/oauth/client_credentials/issuer_spec.rb +0 -86
  215. data/spec/lib/oauth/client_credentials/validation_spec.rb +0 -54
  216. data/spec/lib/oauth/client_credentials_integration_spec.rb +0 -27
  217. data/spec/lib/oauth/client_credentials_request_spec.rb +0 -104
  218. data/spec/lib/oauth/client_spec.rb +0 -39
  219. data/spec/lib/oauth/code_request_spec.rb +0 -45
  220. data/spec/lib/oauth/code_response_spec.rb +0 -34
  221. data/spec/lib/oauth/error_response_spec.rb +0 -61
  222. data/spec/lib/oauth/error_spec.rb +0 -23
  223. data/spec/lib/oauth/forbidden_token_response_spec.rb +0 -23
  224. data/spec/lib/oauth/helpers/scope_checker_spec.rb +0 -64
  225. data/spec/lib/oauth/helpers/unique_token_spec.rb +0 -20
  226. data/spec/lib/oauth/helpers/uri_checker_spec.rb +0 -104
  227. data/spec/lib/oauth/invalid_token_response_spec.rb +0 -28
  228. data/spec/lib/oauth/password_access_token_request_spec.rb +0 -90
  229. data/spec/lib/oauth/pre_authorization_spec.rb +0 -155
  230. data/spec/lib/oauth/refresh_token_request_spec.rb +0 -154
  231. data/spec/lib/oauth/scopes_spec.rb +0 -122
  232. data/spec/lib/oauth/token_request_spec.rb +0 -98
  233. data/spec/lib/oauth/token_response_spec.rb +0 -85
  234. data/spec/lib/oauth/token_spec.rb +0 -116
  235. data/spec/lib/request/strategy_spec.rb +0 -53
  236. data/spec/lib/server_spec.rb +0 -52
  237. data/spec/models/doorkeeper/access_grant_spec.rb +0 -36
  238. data/spec/models/doorkeeper/access_token_spec.rb +0 -394
  239. data/spec/models/doorkeeper/application_spec.rb +0 -179
  240. data/spec/requests/applications/applications_request_spec.rb +0 -94
  241. data/spec/requests/applications/authorized_applications_spec.rb +0 -30
  242. data/spec/requests/endpoints/authorization_spec.rb +0 -72
  243. data/spec/requests/endpoints/token_spec.rb +0 -64
  244. data/spec/requests/flows/authorization_code_errors_spec.rb +0 -66
  245. data/spec/requests/flows/authorization_code_spec.rb +0 -156
  246. data/spec/requests/flows/client_credentials_spec.rb +0 -58
  247. data/spec/requests/flows/implicit_grant_errors_spec.rb +0 -32
  248. data/spec/requests/flows/implicit_grant_spec.rb +0 -61
  249. data/spec/requests/flows/password_spec.rb +0 -115
  250. data/spec/requests/flows/refresh_token_spec.rb +0 -174
  251. data/spec/requests/flows/revoke_token_spec.rb +0 -157
  252. data/spec/requests/flows/skip_authorization_spec.rb +0 -59
  253. data/spec/requests/protected_resources/metal_spec.rb +0 -14
  254. data/spec/requests/protected_resources/private_api_spec.rb +0 -81
  255. data/spec/routing/custom_controller_routes_spec.rb +0 -71
  256. data/spec/routing/default_routes_spec.rb +0 -35
  257. data/spec/routing/scoped_routes_spec.rb +0 -31
  258. data/spec/spec_helper.rb +0 -2
  259. data/spec/spec_helper_integration.rb +0 -59
  260. data/spec/support/dependencies/factory_girl.rb +0 -2
  261. data/spec/support/helpers/access_token_request_helper.rb +0 -11
  262. data/spec/support/helpers/authorization_request_helper.rb +0 -41
  263. data/spec/support/helpers/config_helper.rb +0 -9
  264. data/spec/support/helpers/model_helper.rb +0 -67
  265. data/spec/support/helpers/request_spec_helper.rb +0 -76
  266. data/spec/support/helpers/url_helper.rb +0 -55
  267. data/spec/support/http_method_shim.rb +0 -24
  268. data/spec/support/orm/active_record.rb +0 -3
  269. data/spec/support/shared/controllers_shared_context.rb +0 -69
  270. data/spec/support/shared/models_shared_examples.rb +0 -52
  271. data/spec/validators/redirect_uri_validator_spec.rb +0 -78
data/CHANGELOG.md ADDED
@@ -0,0 +1,1038 @@
1
+ # Changelog
2
+
3
+ See https://github.com/doorkeeper-gem/doorkeeper/wiki/Migration-from-old-versions for
4
+ upgrade guides.
5
+
6
+ User-visible changes worth mentioning.
7
+
8
+ ## main
9
+
10
+ - [#PR ID] Add your PR description here.
11
+
12
+ ## 5.5.2
13
+
14
+ - [#1502] Drop support for Ruby 2.4 because of EOL.
15
+ - [#1504] Updated the url fragment in the comment for code documentation.
16
+ - [#1512] Fix form behavior when response mode is form_post.
17
+ - [#1511] Fix that authorization code is returned by fragment if response_mode is fragament.
18
+
19
+ ## 5.5.1
20
+
21
+ - [#1496] Revoke `old_refresh_token` if `previous_refresh_token` is present.
22
+ - [#1495] Fix `respond_to` undefined in API-only mode
23
+ - [#1488] Verify client authentication for Resource Owner Password Grant when
24
+ `config.skip_client_authentication_for_password_grant` is set and the client credentials
25
+ are sent in a HTTP Basic auth header.
26
+
27
+ ## 5.5.0
28
+
29
+ - [#1482] Simplify `TokenInfoController` to be overridable (extract response rendering).
30
+ - [#1478] Fix ownership association and Rake tasks when custom models configured.
31
+ - [#1477] Respect `ActiveRecord::Base.pluralize_table_names` for Doorkeeper table names.
32
+
33
+ ## 5.5.0.rc2
34
+
35
+ - [#1473] Enable `Applications` and `AuthorizedApplications` controllers in API mode.
36
+
37
+ **[IMPORTANT]** you can still skip these controllers using `skip_controllers` in
38
+ `use_doorkeeper` inside `routes.rb`. Please do it in case you don't need them.
39
+
40
+ - [#1472] Fix `establish_connection` configuration for custom defined models.
41
+ - [#1471] Add support for Ruby 3.0.
42
+ - [#1469] Check if `redirect_uri` exists.
43
+ - [#1465] Memoize nil doorkeeper_token.
44
+ - [#1459] Use built-in Ruby option to remove padding in PKCE code challenge value.
45
+ - [#1457] Make owner_id a bigint for newly-generated owner migrations
46
+ - [#1452] Empty previous_refresh_token only if present.
47
+ - [#1440] Validate empty host in redirect_uri.
48
+ - [#1438] Add form post response mode.
49
+ - [#1458] Make `config.skip_client_authentication_for_password_grant` a long term configuration option.
50
+
51
+ ## 5.5.0.rc1
52
+
53
+ - [#1435] Make error response not redirectable when client is unauthorized
54
+ - [#1426] Ensure ActiveRecord callbacks are executed on token revocation.
55
+ - [#1407] Remove redundant and complex to support helpers froms tests (`should_have_json`, etc).
56
+ - [#1416] Don't add introspection route if token introspection completely disabled.
57
+ - [#1410] Properly memoize `current_resource_owner` value (consider `nil` and `false` values).
58
+ - [#1415] Ignore PKCE params for non-PKCE grants.
59
+ - [#1418] Add ability to register custom OAuth Grant Flows.
60
+ - [#1420] Require client authentication for Resource Owner Password Grant as stated in OAuth RFC.
61
+
62
+ **[IMPORTANT]** you need to create a new OAuth client (`Doorkeeper::Application`) if you didn't
63
+ have it before and use client credentials in HTTP Basic auth if you previously used this grant
64
+ flow without client authentication. To opt out of this you could set the
65
+ `skip_client_authentication_for_password_grant` configuration option to `true`, but note that
66
+ this is in violation of the OAuth spec and represents a security risk.
67
+ All the users of your provider application now need to include client credentials when they use
68
+ this grant flow.
69
+
70
+ - [#1421] Add Resource Owner instance to authorization hook context for `custom_access_token_expires_in`
71
+ configuration option to allow resource owner based Access Tokens TTL.
72
+
73
+ ## 5.4.0
74
+
75
+ - [#1404] Make `Doorkeeper::Application#read_attribute_for_serialization` public.
76
+
77
+ ## 5.4.0.rc2
78
+
79
+ - [#1371] Add `#as_json` method and attributes serialization restriction for Application model.
80
+ Fixes information disclosure vulnerability (CVE-2020-10187).
81
+
82
+ **[IMPORTANT]** you need to re-implement `#as_json` method for Doorkeeper Application model
83
+ if you previously used `#to_json` serialization with custom options or attributes or rely on
84
+ JSON response from /oauth/applications.json or /oauth/authorized_applications.json. This change
85
+ is a breaking change which restricts serialized attributes to a very small set of columns.
86
+
87
+ - [#1395] Fix `NameError: uninitialized constant Doorkeeper::AccessToken` for Rake tasks.
88
+ - [#1397] Add `as: :doorkeeper_application` on Doorkeeper application form in order to support
89
+ custom configured application model.
90
+ - [#1400] Correctly yield the application instance to `allow_grant_flow_for_client?` config
91
+ option (fixes #1398).
92
+ - [#1402] Handle trying authorization with client credentials.
93
+
94
+ ## 5.4.0.rc1
95
+ - [#1366] Sets expiry of token generated using `refresh_token` to that of original token. (Fixes #1364)
96
+ - [#1354] Add `authorize_resource_owner_for_client` option to authorize the calling user to access an application.
97
+ - [#1355] Allow to enable polymorphic Resource Owner association for Access Token & Grant
98
+ models (`use_polymorphic_resource_owner` configuration option).
99
+
100
+ **[IMPORTANT]** Review your custom patches or extensions for Doorkeeper internals if you
101
+ have such - since now Doorkeeper passes Resource Owner instance to every objects and not
102
+ just it's ID. See PR description for details.
103
+
104
+ - [#1356] Remove duplicated scopes from Access Tokens and Grants on attribute assignment.
105
+ - [#1357] Fix `Doorkeeper::OAuth::PreAuthorization#as_json` method causing
106
+ `Stack level too deep` error with AMS (fix #1312).
107
+ - [#1358] Deprecate `active_record_options` configuration option.
108
+ - [#1359] Refactor Doorkeeper configuration options DSL to make it easy to reuse it
109
+ in external extensions.
110
+ - [#1360] Increase `matching_token_for` lookup size to 10 000 and make it configurable.
111
+ - [#1371] Fix controllers to use valid classes in case Doorkeeper has custom models configured.
112
+ - [#1370] Fix revocation response for invalid token and unauthorized requests to conform with RFC 7009 (fixes #1362).
113
+
114
+ **[IMPORTANT]** now fully according to RFC 7009 nobody can do a revocation request without `client_id`
115
+ (for public clients) and `client_secret` (for private clients). Please update your apps to include that
116
+ info in the revocation request payload.
117
+
118
+ - [#1373] Make Doorkeeper routes mapper reusable in extensions.
119
+ - [#1374] Revoke and issue client credentials token in a transaction with a row lock.
120
+ - [#1384] Add context object with auth/pre_auth and issued_token for authorization hooks.
121
+ - [#1387] Add `AccessToken#create_for` and use in `RefreshTokenRequest`.
122
+ - [#1392] Fix `enable_polymorphic_resource_owner` migration template to have proper index name.
123
+ - [#1393] Improve Applications #show page with more informative data on client secret and scopes.
124
+ - [#1394] Use Ruby `autoload` feature to load Doorkeeper files.
125
+
126
+ ## 5.3.3
127
+
128
+ - [#1404] Backport: Make `Doorkeeper::Application#read_attribute_for_serialization` public.
129
+
130
+ ## 5.3.2
131
+
132
+ - [#1371] Backport: add `#as_json` method and attributes serialization restriction for Application model.
133
+ Fixes information disclosure vulnerability (CVE-2020-10187).
134
+
135
+ ## 5.3.1
136
+
137
+ - [#1360] Backport: Increase `matching_token_for` batch lookup size to 10 000 and make it configurable.
138
+
139
+ ## 5.3.0
140
+
141
+ - [#1339] Validate Resource Owner in `PasswordAccessTokenRequest` against `nil` and `false` values.
142
+ - [#1341] Fix `refresh_token_revoked_on_use` with `hash_token_secrets` enabled.
143
+ - [#1343] Fix ruby 2.7 kwargs warning in InvalidTokenResponse.
144
+ - [#1345] Allow to set custom classes for Doorkeeper models, extract reusable AR mixins.
145
+ - [#1346] Refactor `Doorkeeper::Application#to_json` into convenient `#as_json` (fix #1344).
146
+ - [#1349] Fix `Doorkeeper::Application` AR associations using an incorrect foreign key name when using a custom class.
147
+ - [#1318] Make existing token revocation for client credentials optional and disable it by default.
148
+
149
+ **[IMPORTANT]** This is a change compared to the behaviour of version 5.2.
150
+ If you were relying on access tokens being revoked once the same client
151
+ requested a new access token, reenable it with `revoke_previous_client_credentials_token` in Doorkeeper
152
+ initialization file.
153
+
154
+ ## 5.2.6
155
+
156
+ - [#1404] Backport: Make `Doorkeeper::Application#read_attribute_for_serialization` public.
157
+
158
+ ## 5.2.5
159
+
160
+ - [#1371] Backport: add `#as_json` method and attributes serialization restriction for Application model.
161
+ Fixes information disclosure vulnerability (CVE-2020-10187).
162
+
163
+ ## 5.2.4
164
+
165
+ - [#1360] Backport: Increase `matching_token_for` batch lookup size to 10 000 and make it configurable.
166
+
167
+ ## 5.2.3
168
+
169
+ - [#1334] Remove `application_secret` flash helper and `redirect_to` keyword.
170
+ - [#1331] Move redirect_uri_validator to where it is used (`Application` model).
171
+ - [#1326] Move response_type check in pre_authorization to a method to be easily to override.
172
+ - [#1329] Fix `find_in_batches` order warning.
173
+
174
+ ## 5.2.2
175
+
176
+ - [#1320] Call configured `authenticate_resource_owner` method once per request.
177
+ - [#1315] Allow generation of new secret with `Doorkeeper::Application#renew_secret`.
178
+ - [#1309] Allow `Doorkeeper::Application#to_json` to work without arguments.
179
+
180
+ ## 5.2.1
181
+
182
+ - [#1308] Fix flash types for `api_only` mode (no flashes for `ActionController::API`).
183
+ - [#1306] Fix interpolation of `missing_param` I18n.
184
+
185
+ ## 5.2.0
186
+
187
+ - [#1305] Make `Doorkeeper::ApplicationController` to inherit from `ActionController::API` in cases
188
+ when `api_mode` enabled (fixes #1302).
189
+
190
+ ## 5.2.0.rc3
191
+
192
+ - [#1298] Slice strong params so doesn't error with Rails forms.
193
+ - [#1300] Limiting access to attributes of pre_authorization.
194
+ - [#1296] Adding client_id to strong parameters.
195
+
196
+ **[IMPORTANT]** `Doorkeeper::Server#client_via_uid` was removed.
197
+
198
+ - [#1293] Move ar specific redirect uri validator to ar orm directory.
199
+ - [#1288] Allow to pass attributes to the `Doorkeeper::OAuth::PreAuthorization#as_json` method to customize
200
+ the PreAuthorization response.
201
+ - [#1286] Add ability to customize grant flows per application (OAuth client) (#1245 , #1207)
202
+ - [#1283] Allow to customize base class for `Doorkeeper::ApplicationMetalController` (new configuration
203
+ option called `base_metal_controller` (fix #1273).
204
+ - [#1277] Prevent requested scope be empty on authorization request, handle and add description for invalid request.
205
+
206
+ ## 5.2.0.rc2
207
+
208
+ - [#1270] Find matching tokens in batches for `reuse_access_token` option (fix #1193).
209
+ - [#1271] Reintroduce existing token revocation for client credentials.
210
+
211
+ **[IMPORTANT]** If you rely on being able to fetch multiple access tokens from the same
212
+ client using client credentials flow, you should skip to version 5.3, where this behaviour
213
+ is deactivated by default.
214
+
215
+ - [#1269] Update initializer template documentation.
216
+ - [#1266] Use strong parameters within pre-authorization.
217
+ - [#1264] Add :before_successful_authorization and :after_successful_authorization hooks in TokensController
218
+ - [#1263] Response properly when introspection fails and fix configurations's user guide.
219
+
220
+ ## 5.2.0.rc1
221
+
222
+ - [#1260], [#1262] Improve Token Introspection configuration option (access to tokens, client).
223
+ - [#1257] Add constraint configuration when using client authentication on introspection endpoint.
224
+ - [#1252] Returning `unauthorized` when the revocation of the token should not be performed due to wrong permissions.
225
+ - [#1249] Specify case sensitive uniqueness to remove Rails 6 deprecation message
226
+ - [#1248] Display the Application Secret in HTML after creating a new application even when `hash_application_secrets` is used.
227
+ - [#1248] Return the unhashed Application Secret in the JSON response after creating new application even when `hash_application_secrets` is used.
228
+ - [#1238] Better support for native app with support for custom scheme and localhost redirection.
229
+
230
+ ## 5.1.2
231
+
232
+ - [#1404] Backport: Make `Doorkeeper::Application#read_attribute_for_serialization` public.
233
+
234
+ ## 5.1.1
235
+
236
+ - [#1371] Backport: add `#as_json` method and attributes serialization restriction for Application model.
237
+ Fixes information disclosure vulnerability (CVE-2020-10187).
238
+
239
+ ## 5.1.0
240
+
241
+ - [#1243] Add nil check operator in token checking at token introspection.
242
+ - [#1241] Explaining foreign key options for resource owner in a single place
243
+ - [#1237] Allow to set blank redirect URI if Doorkeeper configured to use redirect URI-less grant flows.
244
+ - [#1234] Fix `StaleRecordsCleaner` to properly work with big amount of records.
245
+ - [#1228] Allow to explicitly set non-expiring tokens in `custom_access_token_expires_in` configuration
246
+ option using `Float::INIFINITY` return value.
247
+ - [#1224] Do not try to store token if not found by fallback hashing strategy.
248
+ - [#1223] Update Hound/Rubocop rules, correct Doorkeeper codebase to follow style-guides.
249
+ - [#1220] Drop Rails 4.2 & Ruby < 2.4 support.
250
+
251
+ ## 5.1.0.rc2
252
+
253
+ - [#1208] Unify hashing implementation into secret storing strategies
254
+
255
+ **[IMPORTANT]** If you have been using the master branch of doorkeeper with bcrypt in your Gemfile.lock,
256
+ your application secrets have been hashed using BCrypt. To restore this behavior, use the initializer option
257
+ `hash_application_secrets using: 'Doorkeeper::SecretStoring::BCrypt`.
258
+
259
+ - [#1216] Add nil check to `expires_at` method.
260
+ - [#1215] Fix deprecates for Rails 6.
261
+ - [#1214] Scopes field accepts array.
262
+ - [#1209] Fix tokens validation for Token Introspection request.
263
+ - [#1202] Use correct HTTP status codes for error responses.
264
+
265
+ **[IMPORTANT]**: this change might break your application if you were relying on the previous
266
+ 401 status codes, this is now a 400 by default, or a 401 for `invalid_client` and `invalid_token` errors.
267
+
268
+ - [#1201] Fix custom TTL block `client` parameter to always be an `Doorkeeper::Application` instance.
269
+
270
+ **[IMPORTANT]**: those who defined `custom_access_token_expires_in` configuration option need to check
271
+ their block implementation: if you are using `oauth_client.application` to get `Doorkeeper::Application`
272
+ instance, then you need to replace it with just `oauth_client`.
273
+
274
+ - [#1200] Increase default Doorkeeper access token value complexity (`urlsafe_base64` instead of just `hex`)
275
+ matching RFC6749/RFC6750.
276
+
277
+ **[IMPORTANT]**: this change have possible side-effects in case you have custom database constraints for
278
+ access token value, application secrets, refresh tokens or you patched Doorkeeper models and introduced
279
+ token value validations, or you are using database with case-insensitive WHERE clause like MySQL
280
+ (you can face some collisions). Before this change access token value matched `[a-f0-9]` regex, and now
281
+ it matches `[a-zA-Z0-9\-_]`. In case you have such restrictions and your don't use custom token generator
282
+ please change configuration option `default_generator_method` to `:hex`.
283
+
284
+ - [#1195] Allow to customize Token Introspection response (fixes #1194).
285
+ - [#1189] Option to set `token_reuse_limit`.
286
+ - [#1191] Try to load bcrypt for hashing of application secrets, but add fallback.
287
+
288
+ ## 5.1.0.rc1
289
+
290
+ - [#1188] Use `params` instead of `request.POST` in tokens controller (fixes #1183).
291
+ - [#1182] Fix loopback IP redirect URIs to conform with RFC8252, p. 7.3 (fixes #1170).
292
+ - [#1179] Authorization Code Grant Flow without client id returns invalid_client error.
293
+ - [#1177] Allow to limit `scopes` for certain `grant_types`
294
+ - [#1176] Fix test factory support for `factory_bot_rails`
295
+ - [#1175] Internal refactor: use `scopes_string` inside `scopes`.
296
+ - [#1168] Allow optional hashing of tokens and secrets.
297
+ - [#1164] Fix error when `root_path` is not defined.
298
+ - [#1162] Fix `enforce_content_type` for requests without body.
299
+
300
+ ## 5.0.3
301
+
302
+ - [#1371] Backport: add `#as_json` method and attributes serialization restriction for Application model.
303
+ Fixes information disclosure vulnerability (CVE-2020-10187).
304
+
305
+ ## 5.0.2
306
+
307
+ - [#1158] Fix initializer template: change `handle_auth_errors` option
308
+ - [#1157] Remove redundant index from migration template.
309
+
310
+ ## 5.0.1
311
+
312
+ - [#1154] Refactor `StaleRecordsCleaner` to be ORM agnostic.
313
+ - [#1152] Fix migration template: change resource owner data type from integer to Rails generic `references`
314
+ - [#1151] Fix Refresh Token strategy: add proper validation of client credentials both for Public & Private clients.
315
+ - [#1149] Fix for `URIChecker#valid_for_authorization?` false negative when query is blank, but `?` present.
316
+ - [#1140] Allow rendering custom errors from exceptions (issue #844). Originally opened as [#944].
317
+ - [#1138] Revert regression bug (check for token expiration in Authorizations controller so authorization
318
+ triggers every time)
319
+
320
+ ## 5.0.0
321
+
322
+ - [#1127] Change the token_type initials of the Banner Token to uppercase to comply with the RFC6750 specification.
323
+
324
+ ## 5.0.0.rc2
325
+
326
+ - [#1122] Fix AuthorizationsController#new error response to be in JSON format
327
+ - [#1119] Fix token revocation for OAuth apps using "implicit" grant flow
328
+ - [#1116] `AccessGrant`s will now be revoked along with `AccessToken`s when
329
+ hitting the `AuthorizedApplicationController#destroy` route.
330
+ - [#1114] Make token info endpoint's attributes consistent with token creation
331
+ - [#1108] Simple formating of callback URLs when listing oauth applications
332
+ - [#1106] Restrict access to AdminController with 'Forbidden 403' if admin_authenticator is not
333
+ configured by developers.
334
+
335
+ ## 5.0.0.rc1
336
+
337
+ - [#1103] Allow customizing use_refresh_token
338
+ - [#1089] Removed enable_pkce_without_secret configuration option
339
+ - [#1102] Expiration time based on scopes
340
+ - [#1099] All the configuration variables in `Doorkeeper.configuration` now
341
+ always return a non-nil value (`true` or `false`)
342
+ - [#1099] ORM / Query optimization: Do not revoke the refresh token if it is not enabled
343
+ in `doorkeeper.rb`
344
+ - [#996] Expiration Time Base On Grant Type
345
+ - [#997] Allow PKCE authorization_code flow as specified in RFC7636
346
+ - [#907] Fix lookup for matching tokens in certain edge-cases
347
+ - [#992] Add API option to use Doorkeeper without management views for API only
348
+ Rails applications (`api_only`)
349
+ - [#1045] Validate redirect_uri as the native URI when making authorization code requests
350
+ - [#1048] Remove deprecated `Doorkeeper#configured?`, `Doorkeeper#database_installed?`, and
351
+ `Doorkeeper#installed?` method
352
+ - [#1031] Allow public clients to authenticate without `client_secret`. Define an app as
353
+ either public or private/confidential
354
+
355
+ **[IMPORTANT]**: all the applications (clients) now are considered as private by default.
356
+ You need to manually change `confidential` column to `false` if you are using public clients,
357
+ in other case your mobile (or other) applications will not be able to authorize.
358
+ See [#1142](https://github.com/doorkeeper-gem/doorkeeper/issues/1142) for more details.
359
+
360
+ - [#1010] Add configuration to enforce configured scopes (`default_scopes` and
361
+ `optional_scopes`) for applications
362
+ - [#1060] Ensure that the native redirect_uri parameter matches with redirect_uri of the client
363
+ - [#1064] Add :before_successful_authorization and :after_successful_authorization hooks
364
+ - [#1069] Upgrade Bootstrap to 4 for Admin
365
+ - [#1068] Add rake task to cleanup databases that can become large over time
366
+ - [#1072] AuthorizationsController: Memoize strategy.authorize_response result to enable
367
+ subclasses to use the response object.
368
+ - [#1075] Call `before_successful_authorization` and `after_successful_authorization` hooks
369
+ on `create` action as well as `new`
370
+ - [#1082] Fix #916: remember routes mapping and use it required places (fix error with
371
+ customized Token Info route).
372
+ - [#1086, #1088] Fix bug with receiving default scopes in the token even if they are
373
+ not present in the application scopes (use scopes intersection).
374
+ - [#1076] Add config to enforce content type to application/x-www-form-urlencoded
375
+ - Fix bug with `force_ssl_in_redirect_uri` when it breaks existing applications with an
376
+ SSL redirect_uri.
377
+
378
+ ## 4.4.3
379
+
380
+ - [#1143] Adds a config option `opt_out_native_route_change` to opt out of the breaking api
381
+ changed introduced in https://github.com/doorkeeper-gem/doorkeeper/pull/1003
382
+
383
+ ## 4.4.2
384
+
385
+ - [#1130] Backport fix for native redirect_uri from 5.x.
386
+
387
+ ## 4.4.1
388
+
389
+ - [#1127] Backport token type to comply with the RFC6750 specification.
390
+ - [#1125] Backport Quote surround I18n yes/no keys
391
+
392
+ ## 4.4.0
393
+
394
+ - [#1120] Backport security fix from 5.x for token revocation when using public clients
395
+
396
+ **[IMPORTANT]**: all the applications (clients) now are considered as private by default.
397
+ You need to manually change `confidential` column to `false` if you are using public clients,
398
+ in other case your mobile (or other) applications will not be able to authorize.
399
+ See [#1142](https://github.com/doorkeeper-gem/doorkeeper/issues/1142) for more details.
400
+
401
+ ## 4.3.2
402
+
403
+ - [#1053] Support authorizing with query params in the request `redirect_uri` if explicitly present in app's `Application#redirect_uri`
404
+
405
+ ## 4.3.1
406
+
407
+ - Remove `BaseRecord` and introduce additional concern for ordering methods to fix
408
+ braking changes for Doorkeeper models.
409
+ - [#1032] Refactor BaseRequest callbacks into configurable lambdas
410
+ - [#1040] Clear mixins from ActiveRecord DSL and save only overridable API. It
411
+ allows to use this mixins in Doorkeeper ORM extensions with minimum code boilerplate.
412
+
413
+ ## 4.3.0
414
+
415
+ - [#976] Fix to invalidate the second redirect URI when the first URI is the native URI
416
+ - [#1035] Allow `Application#redirect_uri=` to handle array of URIs.
417
+ - [#1036] Allow to forbid Application redirect URI's with specific rules.
418
+ - [#1029] Deprecate `order_method` and introduce `ordered_by`. Sort applications
419
+ by `created_at` in index action.
420
+ - [#1033] Allow Doorkeeper configuration option #force_ssl_in_redirect_uri to be a callable object.
421
+ - Fix Grape integration & add specs for it
422
+ - [#913] Deferred ORM (ActiveRecord) models loading
423
+ - [#943] Fix Access Token token generation when certain errors occur in custom token generators
424
+ - [#1026] Implement RFC7662 - OAuth 2.0 Token Introspection
425
+ - [#985] Generate valid migration files for Rails >= 5
426
+ - [#972] Replace Struct subclassing with block-form initialization
427
+ - [#1003] Use URL query param to pass through native redirect auth code so automated apps can find it.
428
+
429
+ **[IMPORTANT]**: Previously authorization code response route was `/oauth/authorize/<code>`,
430
+ now it is `oauth/authorize/native?code=<code>` (in order to help applications to automatically find the code value).
431
+
432
+ - [#868] `Scopes#&` and `Scopes#+` now take an array or any other enumerable
433
+ object.
434
+ - [#1019] Remove translation not in use: `invalid_resource_owner`.
435
+ - Use Ruby 2 hash style syntax (min required Ruby version = 2.1)
436
+ - [#948] Make Scopes.<=> work with any "other" value.
437
+ - [#974] Redirect URI is checked without query params within AuthorizationCodeRequest.
438
+ - [#1004] More explicit help text for `native_redirect_uri`.
439
+ - [#1023] Update Ruby versions and test against 2.5.0 on Travis CI.
440
+ - [#1024] Migrate from FactoryGirl to FactoryBot.
441
+ - [#1025] Improve documentation for adding foreign keys
442
+ - [#1028] Make it possible to have composite strategy names.
443
+
444
+ ## 4.2.6
445
+
446
+ - [#970] Escape certain attributes in authorization forms.
447
+
448
+ ## 4.2.5
449
+
450
+ - [#936] Deprecate `Doorkeeper#configured?`, `Doorkeeper#database_installed?`, and
451
+ `Doorkeeper#installed?`
452
+ - [#909] Add `InvalidTokenResponse#reason` reader method to allow read the kind
453
+ of invalid token error.
454
+ - [#928] Test against more recent Ruby versions
455
+ - Small refactorings within the codebase
456
+ - [#921] Switch to Appraisal, and test against Rails master
457
+ - [#892] Add minimum Ruby version requirement
458
+
459
+ ## 4.2.0
460
+
461
+ - Security fix: Address CVE-2016-6582, implement token revocation according to
462
+ spec (tokens might not be revoked if client follows the spec).
463
+ - [#873] Add hooks to Doorkeeper::ApplicationMetalController
464
+ - [#871] Allow downstream users to better utilize doorkeeper spec factories by
465
+ eliminating name conflict on `:user` factory.
466
+
467
+ ## 4.1.0
468
+
469
+ - [#845] Allow customising the `Doorkeeper::ApplicationController` base
470
+ controller
471
+
472
+ ## 4.0.0
473
+
474
+ - [#834] Fix AssetNotPrecompiled error with Sprockets 4
475
+ - [#843] Revert "Fix validation error messages"
476
+ - [#847] Specify Null option to timestamps
477
+
478
+ ## 4.0.0.rc4
479
+
480
+ - [#777] Add support for public client in password grant flow
481
+ - [#823] Make configuration and specs ORM independent
482
+ - [#745] Add created_at timestamp to token generation options
483
+ - [#838] Drop `Application#scopes` generator and warning, introduced for
484
+ upgrading doorkeeper from v2 to v3.
485
+ - [#801] Fix Rails 5 warning messages
486
+ - Test against Rails 5 RC1
487
+
488
+ ## 4.0.0.rc3
489
+
490
+ - [#769] Revoke refresh token on access token use. To make use of the new config
491
+ add `previous_refresh_token` column to `oauth_access_tokens`:
492
+
493
+ ```
494
+ rails generate doorkeeper:previous_refresh_token
495
+ ```
496
+
497
+ - [#811] Toughen parameters filter with exact match
498
+ - [#813] Applications admin bugfix
499
+ - [#799] Fix Ruby Warnings
500
+ - Drop `attr_accessible` from models
501
+
502
+ ### Backward incompatible changes
503
+
504
+ - [#730] Force all timezones to use UTC to prevent comparison issues.
505
+ - [#802] Remove `config.i18n.fallbacks` from engine
506
+
507
+ ## 4.0.0.rc2
508
+
509
+ - Fix optional belongs_to for Rails 5
510
+ - Fix Ruby warnings
511
+
512
+ ## 4.0.0.rc1
513
+
514
+ ### Backward incompatible changes
515
+
516
+ - Drops support for Rails 4.1 and earlier
517
+ - Drops support for Ruby 2.0
518
+ - [#778] Bug fix: use the remaining time that a token is still valid when
519
+ building the redirect URI for the implicit grant flow
520
+
521
+ ### Other changes
522
+
523
+ - [#771] Validation error messages fixes
524
+ - Adds foreign key constraints in generated migrations between tokens and
525
+ grants, and applications
526
+ - Support Rails 5
527
+
528
+ ## 3.1.0
529
+
530
+ - [#736] Existing valid tokens are now reused in client_credentials flow
531
+ - [#749] Allow user to raise authorization error with custom messages.
532
+ Under `resource_owner_authenticator` block a user can
533
+ `raise Doorkeeper::Errors::DoorkeeperError.new('custom_message')`
534
+ - [#762] Check doesn’t abort the actual migration, so it runs
535
+ - [#722] `doorkeeper_forbidden_render_options` now supports returning a 404 by
536
+ specifying `respond_not_found_when_forbidden: true` in the
537
+ `doorkeeper_forbidden_render_options` method.
538
+ - [#734] Simplify and remove duplication in request strategy classes
539
+
540
+ ## 3.0.1
541
+
542
+ - [#712] Wrap exchange of grant token for access token and access token refresh
543
+ in transactions
544
+ - [#704] Allow applications scopes to be mass assigned
545
+ - [#707] Fixed order of Mixin inclusion and table_name configuration in models
546
+ - [#712] Wrap access token and refresh grants in transactions
547
+ - Adds JRuby support
548
+ - Specs, views and documentation adjustments
549
+
550
+ ## 3.0.0
551
+
552
+ ### Other changes
553
+
554
+ - [#693] Updates `en.yml`.
555
+
556
+ ## 3.0.0 (rc2)
557
+
558
+ ### Backward incompatible changes
559
+
560
+ - [#678] Change application-specific scopes to take precedence over server-wide
561
+ scopes. This removes the previous behavior where the intersection between
562
+ application and server scopes was used.
563
+
564
+ ### Other changes
565
+
566
+ - [#671] Fixes `NoMethodError - undefined method 'getlocal'` when calling
567
+ the /oauth/token path. Switch from using a DateTime object to update
568
+ AR to using a Time object. (Issue #668)
569
+ - [#677] Support editing application-specific scopes via the standard forms
570
+ - [#682] Pass error hash to Grape `error!`
571
+ - [#683] Generate application secret/UID if fields are blank strings
572
+
573
+ ## 3.0.0 (rc1)
574
+
575
+ ### Backward incompatible changes
576
+
577
+ - [#648] Extracts mongodb ORMs to
578
+ https://github.com/doorkeeper-gem/doorkeeper-mongodb. If you use ActiveRecord
579
+ you don’t need to do any change, otherwise you will need to install the new
580
+ plugin.
581
+ - [#665] `doorkeeper_unauthorized_render_options(error:)` and
582
+ `doorkeeper_forbidden_render_options(error:)` now accept `error` keyword
583
+ argument.
584
+
585
+ ### Removed deprecations
586
+
587
+ - Removes `doorkeeper_for` deprecation notice.
588
+ - Remove `applications.scopes` upgrade notice.
589
+
590
+ ## 2.2.2
591
+
592
+ - [#541] Fixed `undefined method attr_accessible` problem on Rails 4
593
+ (happens only when ProtectedAttributes gem is used) in #599
594
+
595
+ ## 2.2.1
596
+
597
+ - [#636] `custom_access_token_expires_in` bugfixes
598
+ - [#641] syntax error fix (Issue #612)
599
+ - [#633] Send extra details to Custom Token Generator
600
+ - [#628] Refactor: improve orm adapters to ease extension
601
+ - [#637] Upgrade to rspec to 3.2
602
+
603
+ ## 2.2.0 - 2015-04-19
604
+
605
+ - [#611] Allow custom access token generators to be used
606
+ - [#632] Properly fallback to `default_scopes` when no scope is specified
607
+ - [#622] Clarify that there is a logical OR between scopes for authorizing
608
+ - [#635] Upgrade to rspec 3
609
+ - [#627] i18n fallbacks to english
610
+ - Moved CHANGELOG to NEWS.md
611
+
612
+ ## 2.1.4 - 2015-03-27
613
+
614
+ - [#595] HTTP spec: Add `scope` for refresh token scope param
615
+ - [#596] Limit scopes in app scopes for client credentials
616
+ - [#567] Add Grape helpers for easier integration with Grape framework
617
+ - [#606] Add custom access token expiration support for Client Credentials flow
618
+
619
+ ## 2.1.3 - 2015-03-01
620
+
621
+ - [#588] Fixes scopes_match? bug that skipped authorization form in some cases
622
+
623
+ ## 2.1.2 - 2015-02-25
624
+
625
+ - [#574] Remove unused update authorization route.
626
+ - [#576] Filter out sensitive parameters from logs.
627
+ - [#582] The Authorization HTTP header fields are now case insensitive.
628
+ - [#583] Database connection bugfix in certain scenarios.
629
+ - Testing improvements
630
+
631
+ ## 2.1.1 - 2015-02-06
632
+
633
+ - Remove `wildcard_redirect_url` option
634
+ - [#481] Customize token flow OAuth expirations with a config lambda
635
+ - [#568] TokensController: Memoize strategy.authorize_response result to enable
636
+ subclasses to use the response object.
637
+ - [#571] Fix database initialization issues in some configurations.
638
+ - Documentation improvements
639
+
640
+ ## 2.1.0 - 2015-01-13
641
+
642
+ - [#540] Include `created_at` in response.
643
+ - [#538] Check application-level scopes in client_credentials and password flow.
644
+ - [5596227] Check application scopes in AccessToken when present. Fixes a bug in
645
+ doorkeeper 2.0.0 and 2.0.1 referring to application specific scopes.
646
+ - [#534] Internationalizes doorkeeper views.
647
+ - [#545] Ensure there is a connection to the database before checking for
648
+ missing columns
649
+ - [#546] Use `Doorkeeper::` prefix when referencing `Application` to avoid
650
+ possible application model name conflict.
651
+ - [#538] Test with Rails ~> 4.2.
652
+
653
+ ### Potentially backward incompatible changes
654
+
655
+ - Enable by default `authorization_code` and `client_credentials` grant flows.
656
+ Disables implicit and password grant flows by default.
657
+ - [#510, #544, 722113f] Revoked refresh token response bugfix.
658
+
659
+ ## 2.0.1 - 2014-12-17
660
+
661
+ - [#525, #526, #527] Fix `ActiveRecord::NoDatabaseError` on gem load.
662
+
663
+ ## 2.0.0 - 2014-12-16
664
+
665
+ ### Backward incompatible changes
666
+
667
+ - [#448] Removes `doorkeeper_for` helper. Now we use
668
+ `before_action :doorkeeper_authorize!`.
669
+ - [#469] Allow client applications to restrict the set of allowable scopes.
670
+ Fixes #317. `oauth_applications` relation needs a new `scopes` string column,
671
+ non nullable, which defaults to an empty string. To add the column run:
672
+
673
+ ```
674
+ rails generate doorkeeper:application_scopes
675
+ ```
676
+
677
+ If you’d rather do it by hand, your ActiveRecord migration should contain:
678
+
679
+ ```ruby
680
+ add_column :oauth_applications, :scopes, :string, null: false, default: ‘’
681
+ ```
682
+
683
+ ### Removed deprecations
684
+
685
+ - Removes `test_redirect_uri` option. It is now called `native_redirect_uri`.
686
+ - [#446] Removes `mount Doorkeeper::Engine`. Now we use `use_doorkeeper`.
687
+
688
+ ### Others
689
+
690
+ - [#484] Performance improvement - avoid performing order_by when not required.
691
+ - [#450] When password is invalid in Password Credentials Grant, Doorkeeper
692
+ returned 'invalid_resource_owner' instead of 'invalid_grant', as the spec
693
+ declares. Fixes #444.
694
+ - [#452] Allows `revoked_at` to be set in the future, for future expiry.
695
+ Rationale: https://github.com/doorkeeper-gem/doorkeeper/pull/452#issuecomment-51431459
696
+ - [#480] For Implicit grant flow, access tokens can now be reused. Fixes #421.
697
+ - [#491] Reworks of @jasl's #454 and #478. ORM refactor that allows doorkeeper
698
+ to be extended more easily with unsupported ORMs. It also marks the boundaries
699
+ between shared model code and ORM specifics inside of the gem.
700
+ - [#496] Tests with Rails 4.2.
701
+ - [#489] Adds `force_ssl_in_redirect_uri` to force the usage of the HTTPS
702
+ protocol in non-native redirect uris.
703
+ - [#516] SECURITY: Adds `protect_from_forgery` to `Doorkeeper::ApplicationController`
704
+ - [#518] Fix random failures in mongodb.
705
+
706
+ ---
707
+
708
+ ## 1.4.2 - 2015-03-02
709
+
710
+ - [#576] Filter out sensitive parameters from logs
711
+
712
+ ## 1.4.1 - 2014-12-17
713
+
714
+ - [#516] SECURITY: Adds `protect_from_forgery` to `Doorkeeper::ApplicationController`
715
+
716
+ ## 1.4.0 - 2014-07-31
717
+
718
+ - internals
719
+ - [#427] Adds specs expectations.
720
+ - [#428] Error response refactor.
721
+ - [#417] Moves token validation into Access Token class.
722
+ - [#439] Removes redundant module includes.
723
+ - [#443] TokensController and TokenInfoController inherit from ActionController::Metal
724
+ - bug
725
+ - [#418] fixes #243, requests with insufficient scope now respond 403 instead
726
+ of 401. (API change)
727
+ - [#438] fixes #398, native redirect for implicit token grant bug.
728
+ - [#440] namespace fixes
729
+ - enhancements
730
+ - [#432] Keeps query parameters
731
+
732
+ ## 1.3.1 - 2014-07-06
733
+
734
+ - enhancements
735
+ - [#405] Adds facade to more easily get the token from a request in a route
736
+ constraint.
737
+ - [#415] Extend Doorkeeper TokenResponse with an `after_successful_response`
738
+ callback that allows handling of `response` object.
739
+ - internals
740
+ - [#409] Deprecates `test_redirect_uri` in favor of `native_redirect_uri`.
741
+ See discussion in: [#351].
742
+ - [#411] Clean rspec deprecations. General test improvements.
743
+ - [#412] rspec line width can go longer than 80 (hound CI config).
744
+ - bug
745
+ - [#413] fixes #340, routing scope is now taken into account in redirect.
746
+ - [#401] and [#425] application is not required any longer for access_token.
747
+
748
+ ## 1.3.0 - 2014-05-23
749
+
750
+ - enhancements
751
+ - [#387] Adds reuse_access_token configuration option.
752
+
753
+ ## 1.2.0 - 2014-05-02
754
+
755
+ - enhancements
756
+ - [#376] Allow users to enable basic header authorization for access tokens.
757
+ - [#374] Token revocation implementation [RFC 7009]
758
+ - [#295] Only enable specific grant flows.
759
+ - internals
760
+ - [#381] Locale source fix.
761
+ - [#380] Renames `errors_for` to `doorkeeper_errors_for`.
762
+ - [#390] Style adjustments in accordance with Ruby Style Guide form
763
+ Thoughtbot.
764
+
765
+ ## 1.1.0 - 2014-03-29
766
+
767
+ - enhancements
768
+ - [#336] mongoid4 support.
769
+ - [#372] Allow users to set ActiveRecord table_name_prefix/suffix options
770
+ - internals
771
+ - [#343] separate OAuth's admin and user end-point to different layouts, upgrade theme to Bootstrap 3.1.
772
+ - [#348] Move render_options in filter after `@error` has been set
773
+
774
+ ## 1.0.0 - 2014-01-13
775
+
776
+ - bug (spec)
777
+ - [#228] token response `expires_in` value is now in seconds, relative to
778
+ request time
779
+ - [#296] client is optional for password grant type.
780
+ - [#319] If client credentials are present on password grant type they are validated
781
+ - [#326] If client credentials are present in refresh token they are validated
782
+ - [#326] If authenticated client does not match original client that
783
+ obtained a refresh token it responds `invalid_grant` instead of
784
+ `invalid_client`. Previous usage was invalid according to Section 5.2 of
785
+ the spec.
786
+ - [#329] access tokens' `scopes` string wa being compared against
787
+ `default_scopes` symbols, always unauthorizing.
788
+ - [#318] Include "WWW-Authenticate" header with Unauthorized responses
789
+ - enhancements
790
+ - [#293] Adds ActionController::Instrumentation in TokensController
791
+ - [#298] Support for multiple redirect_uris added.
792
+ - [#313] `AccessToken.revoke_all_for` actually revokes all non-revoked
793
+ tokens for an application/owner instead of deleting them.
794
+ - [#333] Rails 4.1 support
795
+ - internals
796
+ - Removes jQuery dependency [fixes #300][pr #312 is related]
797
+ - [#294] Client uid and secret will be generated only if not present.
798
+ - [#316] Test warnings addressed.
799
+ - [#338] Rspec 3 syntax.
800
+
801
+ ---
802
+
803
+ ## 0.7.4 - 2013-12-01
804
+
805
+ - bug
806
+ - Symbols instead of strings for user input.
807
+
808
+ ## 0.7.3 - 2013-10-04
809
+
810
+ - enhancements
811
+ - [#204] Allow to overwrite scope in routes
812
+ - internals
813
+ - Returns only present keys in Token Response (may imply a backwards
814
+ incompatible change). https://github.com/doorkeeper-gem/doorkeeper/issues/220
815
+ - bug
816
+ - [#290] Support for Rails 4 when 'protected_attributes' gem is present.
817
+
818
+ ## 0.7.2 - 2013-09-11
819
+
820
+ - enhancements
821
+ - [#272] Allow issuing multiple access_tokens for one user/application for multiple devices
822
+ - [#170] Increase length of allowed redirect URIs
823
+ - [#239] Do not try to load unavailable Request class for the current phase.
824
+ - [#273] Relax jquery-rails gem dependency
825
+
826
+ ## 0.7.1 - 2013-08-30
827
+
828
+ - bug
829
+ - [#269] Rails 3.2 raised `ActiveModel::MassAssignmentSecurity::Error`.
830
+
831
+ ## 0.7.0 - 2013-08-21
832
+
833
+ - enhancements
834
+ - [#229] Rails 4!
835
+ - internals
836
+ - [#203] Changing table name to be specific in column_names_with_table
837
+ - [#215] README update
838
+ - [#227] Use Rails.config.paths["config/routes"] instead of assuming "config/routes.rb" exists
839
+ - [#262] Add jquery as gem dependency
840
+ - [#263] Add a configuration for ActiveRecord.establish_connection
841
+ - Deprecation and Ruby warnings (PRs merged outside of GitHub).
842
+
843
+ ## 0.6.7 - 2013-01-13
844
+
845
+ - internals
846
+ - [#188] Add IDs to the show views for integration testing [@egtann](https://github.com/egtann)
847
+
848
+ ## 0.6.6 - 2013-01-04
849
+
850
+ - enhancements
851
+ - [#187] Raise error if configuration is not set
852
+
853
+ ## 0.6.5 - 2012-12-26
854
+
855
+ - enhancements
856
+ - [#184] Vendor the Bootstrap CSS [@tylerhunt](https://github.com/tylerhunt)
857
+
858
+ ## 0.6.4 - 2012-12-15
859
+
860
+ - bug
861
+ - [#180] Add localization to authorized_applications destroy notice [@aalvarado](https://github.com/aalvarado)
862
+
863
+ ## 0.6.3 - 2012-12-07
864
+
865
+ - bugfixes
866
+ - [#163] Error response content-type header should be application/json [@ggayan](https://github.com/ggayan)
867
+ - [#175] Make token.expires_in_seconds return nil when expires_in is nil [@miyagawa](https://github.com/miyagawa)
868
+ - enhancements
869
+ - [#166, #172, #174] Behavior to automatically authorize based on a configured proc
870
+ - internals
871
+ - [#168] Using expectation syntax for controller specs [@rdsoze](https://github.com/rdsoze)
872
+
873
+ ## 0.6.2 - 2012-11-10
874
+
875
+ - bugfixes
876
+ - [#162] Remove ownership columns from base migration template [@rdsoze](https://github.com/rdsoze)
877
+
878
+ ## 0.6.1 - 2012-11-07
879
+
880
+ - bugfixes
881
+ - [#160] Removed |routes| argument from initializer authenticator blocks
882
+ - documentation
883
+ - [#160] Fixed description of context of authenticator blocks
884
+
885
+ ## 0.6.0 - 2012-11-05
886
+
887
+ - enhancements
888
+ - Mongoid `orm` configuration accepts only :mongoid2 or :mongoid3
889
+ - Authorization endpoint does not redirect in #new action anymore. It wasn't specified by OAuth spec
890
+ - TokensController now inherits from ActionController::Metal. There might be performance upgrades
891
+ - Add link to authorization in Applications scaffold
892
+ - [#116] MongoMapper support [@carols10cents](https://github.com/carols10cents)
893
+ - [#122] Mongoid3 support [@petergoldstein](https://github.com/petergoldstein)
894
+ - [#150] Introduce test redirect uri for applications
895
+ - bugfixes
896
+ - [#157] Response token status should be `:ok`, not `:success` [@theycallmeswift](https://github.com/theycallmeswift)
897
+ - [#159] Remove ActionView::Base.field_error_proc override (fixes #145)
898
+ - internals
899
+ - Update development dependencies
900
+ - Several refactorings
901
+ - Rails/ORM are easily swichable with env vars (rails and orm)
902
+ - Travis now tests against Mongoid v2
903
+
904
+ ## 0.5.0 - 2012-10-20
905
+
906
+ Official support for rubinius was removed.
907
+
908
+ - enhancements
909
+ - Configure the way access token is retrieved from request (default to bearer header)
910
+ - Authorization Code expiration time is now configurable
911
+ - Add support for mongoid
912
+ - [#78, #128, #137, #138] Application Ownership
913
+ - [#92] Allow users to skip controllers
914
+ - [#99] Remove deprecated warnings for data-\* attributes [@towerhe](https://github.com/towerhe)
915
+ - [#101] Return existing access_token for PasswordAccessTokenRequest [@benoist](https://github.com/benoist)
916
+ - [#104] Changed access token scopes example code to default_scopes and optional_scopes [@amkirwan](https://github.com/amkirwan)
917
+ - [#107] Fix typos in initializer
918
+ - [#123] i18n for validator, flash messages [@petergoldstein](https://github.com/petergoldstein)
919
+ - [#140] ActiveRecord is the default value for the ORM [@petergoldstein](https://github.com/petergoldstein)
920
+ - internals
921
+ - [#112, #120] Replacing update_attribute with update_column to eliminate deprecation warnings [@rmoriz](https://github.com/rmoriz), [@petergoldstein](https://github.com/petergoldstein)
922
+ - [#121] Updating all development dependencies to recent versions. [@petergoldstein](https://github.com/petergoldstein)
923
+ - [#144] Adding MongoDB dependency to .travis.yml [@petergoldstein](https://github.com/petergoldstein)
924
+ - [#143] Displays errors for unconfigured error messages [@timgaleckas](https://github.com/timgaleckas)
925
+ - bugfixes
926
+ - [#102] Not returning 401 when access token generation fails [@cslew](https://github.com/cslew)
927
+ - [#125] Doorkeeper is using ActiveRecord version of as_json in ORM agnostic code [@petergoldstein](https://github.com/petergoldstein)
928
+ - [#142] Prevent double submission of password based authentication [@bdurand](https://github.com/bdurand)
929
+ - documentation
930
+ - [#141] Add rack-cors middleware to readme [@gottfrois](https://github.com/gottfrois)
931
+
932
+ ## 0.4.2 - 2012-06-05
933
+
934
+ - bugfixes:
935
+ - [#94] Uninitialized Constant in Password Flow
936
+
937
+ ## 0.4.1 - 2012-06-02
938
+
939
+ - enhancements:
940
+ - Backport: Move doorkeeper_for extension to Filter helper
941
+
942
+ ## 0.4.0 - 2012-05-26
943
+
944
+ - deprecation
945
+ - Deprecate authorization_scopes
946
+ - database changes
947
+ - AccessToken#resource_owner_id is not nullable
948
+ - enhancements
949
+ - [#83] Add Resource Owner Password Credentials flow [@jaimeiniesta](https://github.com/jaimeiniesta)
950
+ - [#76] Allow token expiration to be disabled [@mattgreen](https://github.com/mattgreen)
951
+ - [#89] Configure the way client credentials are retrieved from request
952
+ - [#b6470a] Add Client Credentials flow
953
+ - internals
954
+ - [#2ece8d, #f93778] Introduce Client and ErrorResponse classes
955
+
956
+ ## 0.3.4 - 2012-05-24
957
+
958
+ - Fix attr_accessible for rails 3.2.x
959
+
960
+ ## 0.3.3 - 2012-05-07
961
+
962
+ - [#86] shrink gem package size
963
+
964
+ ## 0.3.2 - 2012-04-29
965
+
966
+ - enhancements
967
+ - [#54] Ignore Authorization: headers that are not Bearer [@miyagawa](https://github.com/miyagawa)
968
+ - [#58, #64] Add destroy action to applications endpoint [@jaimeiniesta](https://github.com/jaimeiniesta), [@davidfrey](https://github.com/davidfrey)
969
+ - [#63] TokensController responds with `401 unauthorized` [@jaimeiniesta](https://github.com/jaimeiniesta)
970
+ - [#67, #72] Fix for mass-assignment [@cicloid](https://github.com/cicloid)
971
+ - internals
972
+ - [#49] Add Gemnasium status image to README [@laserlemon](https://github.com/laserlemon)
973
+ - [#50] Fix typos [@tomekw](https://github.com/tomekw)
974
+ - [#51] Updated the factory_girl_rails dependency, fix expires_in response which returned a float number instead of integer [@antekpiechnik](https://github.com/antekpiechnik)
975
+ - [#62] Typos, .gitignore [@jaimeiniesta](https://github.com/jaimeiniesta)
976
+ - [#65] Change \_path redirections to \_url redirections [@jaimeiniesta](https://github.com/jaimeiniesta)
977
+ - [#75] Fix unknown method #authenticate_admin! [@mattgreen](https://github.com/mattgreen)
978
+ - Remove application link in authorized app view
979
+
980
+ ## 0.3.1 - 2012-02-17
981
+
982
+ - enhancements
983
+ - [#48] Add if, else options to doorkeeper_for
984
+ - Add views generator
985
+ - internals
986
+ - Namespace models
987
+
988
+ ## 0.3.0 - 2012-02-11
989
+
990
+ - enhancements
991
+ - [#17, #31] Add support for client credentials in basic auth header [@GoldsteinTechPartners](https://github.com/GoldsteinTechPartners)
992
+ - [#28] Add indices to migration [@GoldsteinTechPartners](https://github.com/GoldsteinTechPartners)
993
+ - [#29] Allow doorkeeper to run with rails 3.2 [@john-griffin](https://github.com/john-griffin)
994
+ - [#30] Improve client's redirect uri validation [@GoldsteinTechPartners](https://github.com/GoldsteinTechPartners)
995
+ - [#32] Add token (implicit grant) flow [@GoldsteinTechPartners](https://github.com/GoldsteinTechPartners)
996
+ - [#34] Add support for custom unathorized responses [@GoldsteinTechPartners](https://github.com/GoldsteinTechPartners)
997
+ - [#36] Remove repetitions from the Authorised Applications view [@carvil](https://github.com/carvil)
998
+ - When user revoke an application, all tokens for that application are revoked
999
+ - Error messages now can be translated
1000
+ - Install generator copies the error messages localization file
1001
+ - internals
1002
+ - Fix deprecation warnings in ActiveSupport::Base64
1003
+ - Remove deprecation in doorkeeper_for that handles hash arguments
1004
+ - Depends on railties instead of whole rails framework
1005
+ - CI now integrates with rails 3.1 and 3.2
1006
+
1007
+ ## 0.2.0 - 2011-12-17
1008
+
1009
+ - enhancements
1010
+ - [#4] Add authorized applications endpoint
1011
+ - [#5, #11] Add access token scopes
1012
+ - [#10] Add access token expiration by default
1013
+ - [#9, #12] Add refresh token flow
1014
+ - internals
1015
+ - [#7] Improve configuration options with :default
1016
+ - Improve configuration options with :builder
1017
+ - Refactor config class
1018
+ - Improve coverage of authorization request integration
1019
+ - bug fixes
1020
+ - [#6, #20] Fix access token response headers
1021
+ - Fix issue with state parameter
1022
+ - deprecation
1023
+ - deprecate :only and :except options in doorkeeper_for
1024
+
1025
+ ## 0.1.1 - 2011-11-30
1026
+
1027
+ - enhancements
1028
+ - [#3] Authorization code must be short lived and single use
1029
+ - [#2] Improve views provided by doorkeeper
1030
+ - [#1] Skips authorization form if the client has been authorized by the resource owner
1031
+ - Improve readme
1032
+ - bugfixes
1033
+ - Fix issue when creating the access token (wrong client id)
1034
+
1035
+ ## 0.1.0 - 2011-11-25
1036
+
1037
+ - Authorization Code flow
1038
+ - OAuth applications endpoint