doorkeeper 5.0.3 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +2 -1
  3. data/.rubocop.yml +37 -4
  4. data/.travis.yml +11 -21
  5. data/Appraisals +29 -7
  6. data/Dangerfile +5 -2
  7. data/Gemfile +19 -5
  8. data/NEWS.md +81 -21
  9. data/README.md +75 -485
  10. data/Rakefile +10 -8
  11. data/app/controllers/doorkeeper/application_controller.rb +1 -2
  12. data/app/controllers/doorkeeper/application_metal_controller.rb +2 -13
  13. data/app/controllers/doorkeeper/applications_controller.rb +20 -8
  14. data/app/controllers/doorkeeper/authorized_applications_controller.rb +1 -1
  15. data/app/controllers/doorkeeper/token_info_controller.rb +2 -2
  16. data/app/controllers/doorkeeper/tokens_controller.rb +11 -11
  17. data/app/helpers/doorkeeper/dashboard_helper.rb +1 -1
  18. data/app/validators/redirect_uri_validator.rb +5 -2
  19. data/app/views/doorkeeper/applications/_form.html.erb +6 -0
  20. data/app/views/doorkeeper/applications/show.html.erb +1 -1
  21. data/app/views/layouts/doorkeeper/admin.html.erb +5 -3
  22. data/bin/console +16 -0
  23. data/config/locales/en.yml +1 -0
  24. data/doorkeeper.gemspec +24 -21
  25. data/gemfiles/rails_5_0.gemfile +9 -4
  26. data/gemfiles/rails_5_1.gemfile +9 -4
  27. data/gemfiles/rails_5_2.gemfile +10 -5
  28. data/gemfiles/rails_6_0.gemfile +17 -0
  29. data/gemfiles/rails_master.gemfile +9 -9
  30. data/lib/doorkeeper/config/option.rb +64 -0
  31. data/lib/doorkeeper/config.rb +191 -75
  32. data/lib/doorkeeper/engine.rb +1 -1
  33. data/lib/doorkeeper/grape/authorization_decorator.rb +4 -4
  34. data/lib/doorkeeper/grape/helpers.rb +3 -3
  35. data/lib/doorkeeper/helpers/controller.rb +3 -2
  36. data/lib/doorkeeper/models/access_grant_mixin.rb +20 -3
  37. data/lib/doorkeeper/models/access_token_mixin.rb +63 -19
  38. data/lib/doorkeeper/models/application_mixin.rb +43 -1
  39. data/lib/doorkeeper/models/concerns/expirable.rb +4 -2
  40. data/lib/doorkeeper/models/concerns/ownership.rb +1 -6
  41. data/lib/doorkeeper/models/concerns/reusable.rb +19 -0
  42. data/lib/doorkeeper/models/concerns/revocable.rb +2 -1
  43. data/lib/doorkeeper/models/concerns/scopes.rb +5 -1
  44. data/lib/doorkeeper/models/concerns/secret_storable.rb +108 -0
  45. data/lib/doorkeeper/oauth/authorization/code.rb +2 -2
  46. data/lib/doorkeeper/oauth/authorization/token.rb +12 -7
  47. data/lib/doorkeeper/oauth/authorization/uri_builder.rb +1 -1
  48. data/lib/doorkeeper/oauth/authorization_code_request.rb +6 -4
  49. data/lib/doorkeeper/oauth/client.rb +1 -1
  50. data/lib/doorkeeper/oauth/client_credentials/validation.rb +5 -4
  51. data/lib/doorkeeper/oauth/client_credentials_request.rb +1 -1
  52. data/lib/doorkeeper/oauth/code_response.rb +2 -2
  53. data/lib/doorkeeper/oauth/error_response.rb +10 -6
  54. data/lib/doorkeeper/oauth/forbidden_token_response.rb +1 -1
  55. data/lib/doorkeeper/oauth/helpers/scope_checker.rb +23 -8
  56. data/lib/doorkeeper/oauth/helpers/unique_token.rb +13 -1
  57. data/lib/doorkeeper/oauth/helpers/uri_checker.rb +37 -1
  58. data/lib/doorkeeper/oauth/invalid_token_response.rb +5 -1
  59. data/lib/doorkeeper/oauth/password_access_token_request.rb +7 -2
  60. data/lib/doorkeeper/oauth/pre_authorization.rb +11 -5
  61. data/lib/doorkeeper/oauth/refresh_token_request.rb +5 -2
  62. data/lib/doorkeeper/oauth/scopes.rb +5 -3
  63. data/lib/doorkeeper/oauth/token.rb +2 -2
  64. data/lib/doorkeeper/oauth/token_introspection.rb +74 -8
  65. data/lib/doorkeeper/oauth/token_response.rb +9 -9
  66. data/lib/doorkeeper/oauth.rb +5 -5
  67. data/lib/doorkeeper/orm/active_record/access_grant.rb +27 -13
  68. data/lib/doorkeeper/orm/active_record/access_token.rb +6 -13
  69. data/lib/doorkeeper/orm/active_record/application.rb +21 -57
  70. data/lib/doorkeeper/orm/active_record/stale_records_cleaner.rb +10 -3
  71. data/lib/doorkeeper/orm/active_record.rb +6 -6
  72. data/lib/doorkeeper/rails/helpers.rb +1 -1
  73. data/lib/doorkeeper/rails/routes/mapping.rb +7 -7
  74. data/lib/doorkeeper/rails/routes.rb +11 -11
  75. data/lib/doorkeeper/rake/db.rake +13 -13
  76. data/lib/doorkeeper/rake.rb +1 -1
  77. data/lib/doorkeeper/request.rb +1 -1
  78. data/lib/doorkeeper/secret_storing/base.rb +64 -0
  79. data/lib/doorkeeper/secret_storing/bcrypt.rb +60 -0
  80. data/lib/doorkeeper/secret_storing/plain.rb +33 -0
  81. data/lib/doorkeeper/secret_storing/sha256_hash.rb +26 -0
  82. data/lib/doorkeeper/stale_records_cleaner.rb +1 -1
  83. data/lib/doorkeeper/version.rb +3 -3
  84. data/lib/doorkeeper.rb +69 -60
  85. data/lib/generators/doorkeeper/application_owner_generator.rb +10 -9
  86. data/lib/generators/doorkeeper/confidential_applications_generator.rb +10 -9
  87. data/lib/generators/doorkeeper/install_generator.rb +11 -9
  88. data/lib/generators/doorkeeper/migration_generator.rb +9 -9
  89. data/lib/generators/doorkeeper/pkce_generator.rb +10 -9
  90. data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +10 -9
  91. data/lib/generators/doorkeeper/templates/initializer.rb +120 -13
  92. data/lib/generators/doorkeeper/templates/migration.rb.erb +15 -7
  93. data/lib/generators/doorkeeper/views_generator.rb +6 -4
  94. data/spec/controllers/application_metal_controller_spec.rb +24 -10
  95. data/spec/controllers/applications_controller_spec.rb +54 -52
  96. data/spec/controllers/authorizations_controller_spec.rb +139 -145
  97. data/spec/controllers/protected_resources_controller_spec.rb +78 -76
  98. data/spec/controllers/token_info_controller_spec.rb +14 -12
  99. data/spec/controllers/tokens_controller_spec.rb +167 -108
  100. data/spec/dummy/Rakefile +3 -1
  101. data/spec/dummy/app/controllers/application_controller.rb +3 -1
  102. data/spec/dummy/app/controllers/custom_authorizations_controller.rb +2 -0
  103. data/spec/dummy/app/controllers/full_protected_resources_controller.rb +4 -2
  104. data/spec/dummy/app/controllers/home_controller.rb +5 -3
  105. data/spec/dummy/app/controllers/metal_controller.rb +2 -0
  106. data/spec/dummy/app/controllers/semi_protected_resources_controller.rb +4 -2
  107. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  108. data/spec/dummy/app/models/user.rb +2 -0
  109. data/spec/dummy/config/application.rb +25 -1
  110. data/spec/dummy/config/environments/development.rb +2 -0
  111. data/spec/dummy/config/environments/production.rb +2 -0
  112. data/spec/dummy/config/environments/test.rb +3 -1
  113. data/spec/dummy/config/initializers/backtrace_silencers.rb +2 -0
  114. data/spec/dummy/config/initializers/doorkeeper.rb +5 -2
  115. data/spec/dummy/config/initializers/secret_token.rb +3 -1
  116. data/spec/dummy/config/initializers/session_store.rb +3 -1
  117. data/spec/dummy/config/initializers/wrap_parameters.rb +2 -0
  118. data/spec/dummy/config.ru +3 -1
  119. data/spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb +17 -10
  120. data/spec/dummy/db/migrate/20170822064514_enable_pkce.rb +2 -0
  121. data/spec/dummy/db/schema.rb +1 -1
  122. data/spec/dummy/script/rails +5 -3
  123. data/spec/factories.rb +8 -6
  124. data/spec/generators/application_owner_generator_spec.rb +13 -26
  125. data/spec/generators/confidential_applications_generator_spec.rb +12 -28
  126. data/spec/generators/install_generator_spec.rb +17 -15
  127. data/spec/generators/migration_generator_spec.rb +13 -26
  128. data/spec/generators/pkce_generator_spec.rb +11 -26
  129. data/spec/generators/previous_refresh_token_generator_spec.rb +16 -29
  130. data/spec/generators/templates/routes.rb +2 -0
  131. data/spec/generators/views_generator_spec.rb +14 -12
  132. data/spec/grape/grape_integration_spec.rb +34 -32
  133. data/spec/helpers/doorkeeper/dashboard_helper_spec.rb +9 -7
  134. data/spec/lib/config_spec.rb +268 -99
  135. data/spec/lib/doorkeeper_spec.rb +3 -1
  136. data/spec/lib/models/expirable_spec.rb +22 -8
  137. data/spec/lib/models/reusable_spec.rb +40 -0
  138. data/spec/lib/models/revocable_spec.rb +8 -6
  139. data/spec/lib/models/scopes_spec.rb +27 -13
  140. data/spec/lib/models/secret_storable_spec.rb +135 -0
  141. data/spec/lib/oauth/authorization/uri_builder_spec.rb +17 -15
  142. data/spec/lib/oauth/authorization_code_request_spec.rb +34 -11
  143. data/spec/lib/oauth/base_request_spec.rb +20 -8
  144. data/spec/lib/oauth/base_response_spec.rb +3 -1
  145. data/spec/lib/oauth/client/credentials_spec.rb +24 -22
  146. data/spec/lib/oauth/client_credentials/creator_spec.rb +56 -10
  147. data/spec/lib/oauth/client_credentials/issuer_spec.rb +27 -18
  148. data/spec/lib/oauth/client_credentials/validation_spec.rb +20 -15
  149. data/spec/lib/oauth/client_credentials_integration_spec.rb +7 -5
  150. data/spec/lib/oauth/client_credentials_request_spec.rb +27 -21
  151. data/spec/lib/oauth/client_spec.rb +15 -13
  152. data/spec/lib/oauth/code_request_spec.rb +8 -6
  153. data/spec/lib/oauth/code_response_spec.rb +9 -7
  154. data/spec/lib/oauth/error_response_spec.rb +19 -11
  155. data/spec/lib/oauth/error_spec.rb +4 -2
  156. data/spec/lib/oauth/forbidden_token_response_spec.rb +7 -5
  157. data/spec/lib/oauth/helpers/scope_checker_spec.rb +68 -31
  158. data/spec/lib/oauth/helpers/unique_token_spec.rb +8 -6
  159. data/spec/lib/oauth/helpers/uri_checker_spec.rb +115 -95
  160. data/spec/lib/oauth/invalid_token_response_spec.rb +3 -1
  161. data/spec/lib/oauth/password_access_token_request_spec.rb +79 -30
  162. data/spec/lib/oauth/pre_authorization_spec.rb +80 -54
  163. data/spec/lib/oauth/refresh_token_request_spec.rb +36 -33
  164. data/spec/lib/oauth/scopes_spec.rb +63 -61
  165. data/spec/lib/oauth/token_request_spec.rb +79 -24
  166. data/spec/lib/oauth/token_response_spec.rb +40 -38
  167. data/spec/lib/oauth/token_spec.rb +60 -44
  168. data/spec/lib/request/strategy_spec.rb +3 -1
  169. data/spec/lib/secret_storing/base_spec.rb +60 -0
  170. data/spec/lib/secret_storing/bcrypt_spec.rb +49 -0
  171. data/spec/lib/secret_storing/plain_spec.rb +44 -0
  172. data/spec/lib/secret_storing/sha256_hash_spec.rb +48 -0
  173. data/spec/lib/server_spec.rb +16 -14
  174. data/spec/lib/stale_records_cleaner_spec.rb +17 -17
  175. data/spec/models/doorkeeper/access_grant_spec.rb +80 -15
  176. data/spec/models/doorkeeper/access_token_spec.rb +198 -73
  177. data/spec/models/doorkeeper/application_spec.rb +280 -288
  178. data/spec/requests/applications/applications_request_spec.rb +98 -66
  179. data/spec/requests/applications/authorized_applications_spec.rb +20 -18
  180. data/spec/requests/endpoints/authorization_spec.rb +25 -23
  181. data/spec/requests/endpoints/token_spec.rb +38 -36
  182. data/spec/requests/flows/authorization_code_errors_spec.rb +26 -24
  183. data/spec/requests/flows/authorization_code_spec.rb +193 -151
  184. data/spec/requests/flows/client_credentials_spec.rb +54 -52
  185. data/spec/requests/flows/implicit_grant_errors_spec.rb +10 -8
  186. data/spec/requests/flows/implicit_grant_spec.rb +27 -25
  187. data/spec/requests/flows/password_spec.rb +59 -55
  188. data/spec/requests/flows/refresh_token_spec.rb +45 -43
  189. data/spec/requests/flows/revoke_token_spec.rb +40 -54
  190. data/spec/requests/flows/skip_authorization_spec.rb +23 -21
  191. data/spec/requests/protected_resources/metal_spec.rb +7 -5
  192. data/spec/requests/protected_resources/private_api_spec.rb +35 -33
  193. data/spec/routing/custom_controller_routes_spec.rb +71 -65
  194. data/spec/routing/default_routes_spec.rb +22 -20
  195. data/spec/routing/scoped_routes_spec.rb +20 -18
  196. data/spec/spec_helper.rb +15 -13
  197. data/spec/spec_helper_integration.rb +3 -1
  198. data/spec/support/dependencies/factory_bot.rb +3 -1
  199. data/spec/support/doorkeeper_rspec.rb +3 -1
  200. data/spec/support/helpers/access_token_request_helper.rb +3 -1
  201. data/spec/support/helpers/authorization_request_helper.rb +4 -2
  202. data/spec/support/helpers/config_helper.rb +2 -0
  203. data/spec/support/helpers/model_helper.rb +3 -1
  204. data/spec/support/helpers/request_spec_helper.rb +5 -3
  205. data/spec/support/helpers/url_helper.rb +9 -7
  206. data/spec/support/http_method_shim.rb +4 -9
  207. data/spec/support/orm/active_record.rb +3 -1
  208. data/spec/support/shared/controllers_shared_context.rb +18 -16
  209. data/spec/support/shared/hashing_shared_context.rb +36 -0
  210. data/spec/support/shared/models_shared_examples.rb +12 -10
  211. data/spec/validators/redirect_uri_validator_spec.rb +74 -45
  212. data/spec/version/version_spec.rb +7 -5
  213. metadata +60 -26
  214. data/gemfiles/rails_4_2.gemfile +0 -13
  215. data/spec/dummy/config/initializers/new_framework_defaults.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 897eb14bd6b334b3b9f69f5cd54bfe524baddc09b3f96159f29a3c0b32b89d9b
4
- data.tar.gz: b7bdd3e4d3cef46cb68fca0ac0bc854b5fa28c170c70a244b331b223d035d16f
3
+ metadata.gz: d8ea67fd14f902f63a276aed1f57a134c39fa02322d4b1f114571e2a90310ead
4
+ data.tar.gz: 44f9f0b886117c6dabe6a09c236107ba6b8c3469b40526a4f6c10f2e4b3e8eac
5
5
  SHA512:
6
- metadata.gz: ff4eb6145d1a432a2cb31055ccf4fcbbaa0d91f3cb8c59ad061ede4d25b6ca345e1b5404c7180816524b5e0c650e359189d42790be61d025eeb940781accac52
7
- data.tar.gz: 30463a001c175d07cecda2f760ed669c5c460c6fd0e3ed802b9988c8ca3b15e80fd335022f61b9cec9954d7906c53e160a3462df8988f9f0a756dff2a7452cb1
6
+ metadata.gz: 2aa8f4fbe445a84f98035e8ebeb99e715860fb7d29637d8e6cca994bf18a9ba7c051d38fda66829a5dd260f93ee74ff9f6f6d863e610203fa690da7b698b7da1
7
+ data.tar.gz: 5d474565c95e341b7b4773a7c1e2a782fa1bc27c4f22874428db52ceb4df10ccbb342420ba5266ba0d779380d42df3576f56449d390ecbf795e4deee50bdaff4
data/.hound.yml CHANGED
@@ -1,2 +1,3 @@
1
- ruby:
1
+ rubocop:
2
2
  config_file: .rubocop.yml
3
+ version: 0.64.0
data/.rubocop.yml CHANGED
@@ -1,17 +1,50 @@
1
1
  AllCops:
2
+ TargetRubyVersion: 2.4
2
3
  Exclude:
3
4
  - "spec/dummy/db/*"
5
+ - "spec/dummy/config/*"
6
+ - "Dangerfile"
7
+ - "gemfiles/*.gemfile"
4
8
 
5
9
  Metrics/BlockLength:
6
10
  Exclude:
7
11
  - spec/**/*
12
+ - lib/doorkeeper/rake/*
8
13
 
9
- LineLength:
14
+ Metrics/LineLength:
10
15
  Exclude:
11
16
  - spec/**/*
17
+ Max: 100
12
18
 
13
- StringLiterals:
14
- Enabled: false
19
+ Metrics/MethodLength:
20
+ Exclude:
21
+ - spec/dummy/db/*
22
+
23
+ Style/StringLiterals:
24
+ EnforcedStyle: double_quotes
25
+ Style/StringLiteralsInInterpolation:
26
+ EnforcedStyle: double_quotes
27
+
28
+ Style/FrozenStringLiteralComment:
29
+ Enabled: true
30
+
31
+ Style/TrailingCommaInHashLiteral:
32
+ EnforcedStyleForMultiline: consistent_comma
33
+ Style/TrailingCommaInArrayLiteral:
34
+ EnforcedStyleForMultiline: consistent_comma
35
+
36
+ Style/SymbolArray:
37
+ MinSize: 3
38
+ Style/WordArray:
39
+ MinSize: 3
40
+
41
+ Style/ClassAndModuleChildren:
42
+ Exclude:
43
+ - spec/**/*
15
44
 
16
- TrailingBlankLines:
45
+ Layout/MultilineMethodCallIndentation:
46
+ EnforcedStyle: indented
47
+ Layout/TrailingBlankLines:
17
48
  Enabled: true
49
+ Layout/DotPosition:
50
+ EnforcedStyle: leading
data/.travis.yml CHANGED
@@ -1,24 +1,21 @@
1
- cache: bundler
2
1
  language: ruby
3
- sudo: false
2
+ cache: bundler
4
3
 
5
4
  rvm:
6
- - 2.1
7
- - 2.2
8
- - 2.3
9
5
  - 2.4
10
6
  - 2.5
11
- - ruby-2.6.0-preview1
7
+ - 2.6
8
+ - ruby-head
12
9
 
13
- before_install:
14
- - gem update --system # Need for Ruby 2.5.0. https://github.com/travis-ci/travis-ci/issues/8978
15
- - gem install bundler -v '~> 1.10'
10
+ #before_install:
11
+ # - gem update --system
12
+ # - gem install bundler
16
13
 
17
14
  gemfile:
18
- - gemfiles/rails_4_2.gemfile
19
15
  - gemfiles/rails_5_0.gemfile
20
16
  - gemfiles/rails_5_1.gemfile
21
17
  - gemfiles/rails_5_2.gemfile
18
+ - gemfiles/rails_6_0.gemfile
22
19
  - gemfiles/rails_master.gemfile
23
20
 
24
21
  matrix:
@@ -29,17 +26,10 @@ matrix:
29
26
  gemfile: gemfiles/rails_5_2.gemfile
30
27
  script: bundle exec danger
31
28
  exclude:
32
- - gemfile: gemfiles/rails_5_0.gemfile
33
- rvm: 2.1
34
- - gemfile: gemfiles/rails_5_1.gemfile
35
- rvm: 2.1
36
- - gemfile: gemfiles/rails_5_2.gemfile
37
- rvm: 2.1
38
- - gemfile: gemfiles/rails_master.gemfile
39
- rvm: 2.1
40
- - gemfile: gemfiles/rails_master.gemfile
41
- rvm: 2.2
29
+ - gemfile: gemfiles/rails_6_0.gemfile
30
+ rvm: 2.4
42
31
  - gemfile: gemfiles/rails_master.gemfile
43
- rvm: 2.3
32
+ rvm: 2.4
44
33
  allow_failures:
45
34
  - gemfile: gemfiles/rails_master.gemfile
35
+ - rvm: ruby-head
data/Appraisals CHANGED
@@ -1,18 +1,40 @@
1
- appraise "rails-4-2" do
2
- gem "rails", "~> 4.2.0"
3
- end
1
+ # frozen_string_literal: true
4
2
 
5
3
  appraise "rails-5-0" do
6
4
  gem "rails", "~> 5.0.0"
7
- gem "rspec-rails", "~> 3.7"
5
+ gem "sqlite3", "~> 1.3", "< 1.4", platform: %i[ruby mswin mingw x64_mingw]
8
6
  end
9
7
 
10
8
  appraise "rails-5-1" do
11
9
  gem "rails", "~> 5.1.0"
12
- gem "rspec-rails", "~> 3.7"
10
+ gem "sqlite3", "~> 1.3", "< 1.4", platform: %i[ruby mswin mingw x64_mingw]
11
+ end
12
+
13
+ appraise "rails-5-2" do
14
+ gem "rails", "~> 5.2.0"
15
+ gem "sqlite3", "~> 1.3", "< 1.4", platform: %i[ruby mswin mingw x64_mingw]
16
+ end
17
+
18
+ appraise "rails-6-0" do
19
+ gem "rails", "~> 6.0.0.beta3"
20
+ gem "sqlite3", "~> 1.4", platform: %i[ruby mswin mingw x64_mingw]
21
+
22
+ # TODO: Remove when rspec-rails 4.0 released
23
+ gem "rspec-core", github: "rspec/rspec-core"
24
+ gem "rspec-expectations", github: "rspec/rspec-expectations"
25
+ gem "rspec-mocks", github: "rspec/rspec-mocks"
26
+ gem "rspec-rails", github: "rspec/rspec-rails", branch: "4-0-dev"
27
+ gem "rspec-support", github: "rspec/rspec-support"
13
28
  end
14
29
 
15
30
  appraise "rails-master" do
16
- gem "rails", git: 'https://github.com/rails/rails'
17
- gem "arel", git: 'https://github.com/rails/arel'
31
+ gem "rails", git: "https://github.com/rails/rails"
32
+ gem "sqlite3", "~> 1.4", platform: %i[ruby mswin mingw x64_mingw]
33
+
34
+ # TODO: Remove when rspec-rails 4.0 released
35
+ gem "rspec-core", github: "rspec/rspec-core"
36
+ gem "rspec-expectations", github: "rspec/rspec-expectations"
37
+ gem "rspec-mocks", github: "rspec/rspec-mocks"
38
+ gem "rspec-rails", github: "rspec/rspec-rails", branch: "4-0-dev"
39
+ gem "rspec-support", github: "rspec/rspec-support"
18
40
  end
data/Dangerfile CHANGED
@@ -17,7 +17,7 @@ end
17
17
  # --------------------------------------------------------------------------------------------------------------------
18
18
  # Has any changes happened inside the actual library code?
19
19
  # --------------------------------------------------------------------------------------------------------------------
20
- has_app_changes = !git.modified_files.grep(/lib/).empty?
20
+ has_app_changes = !git.modified_files.grep(/lib|app/).empty?
21
21
  has_spec_changes = !git.modified_files.grep(/spec/).empty?
22
22
 
23
23
  # --------------------------------------------------------------------------------------------------------------------
@@ -52,7 +52,10 @@ Here's an example of a #{CHANGELOG_FILE} entry:
52
52
  ```
53
53
  MARKDOWN
54
54
 
55
- fail("Please include a changelog entry. \nYou can find it at [#{CHANGELOG_FILE}](#{GITHUB_REPO}/blob/master/#{CHANGELOG_FILE}).")
55
+ warn(
56
+ "Please include a changelog entry. \nYou can find it at [#{CHANGELOG_FILE}](#{GITHUB_REPO}/blob/master/#{CHANGELOG_FILE})." +
57
+ "You can skip this warning only if you made some typo fix or other small changes that didn't affect the API."
58
+ )
56
59
  end
57
60
 
58
61
  if git.commits.any? { |commit| commit.message =~ /^Merge branch '#{github.branch_for_base}'/ }
data/Gemfile CHANGED
@@ -1,10 +1,24 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
4
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
5
+
6
+ gemspec
7
+
8
+ gem "rails", "~> 6.0.0.beta3"
2
9
 
3
- gem "rails", "~> 5.2"
10
+ # TODO: Remove when rspec-rails 4.0 released
11
+ gem "rspec-core", github: "rspec/rspec-core"
12
+ gem "rspec-expectations", github: "rspec/rspec-expectations"
13
+ gem "rspec-mocks", github: "rspec/rspec-mocks"
14
+ gem "rspec-rails", github: "rspec/rspec-rails", branch: "4-0-dev"
15
+ gem "rspec-support", github: "rspec/rspec-support"
4
16
 
5
- gem "appraisal"
17
+ gem "rubocop", "~> 0.66"
18
+
19
+ gem "bcrypt", "~> 3.1", require: false
6
20
 
7
21
  gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
8
- gem "sqlite3", platform: [:ruby, :mswin, :mingw, :x64_mingw]
9
- gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
10
- gemspec
22
+ gem "sqlite3", "~> 1.4", platform: %i[ruby mswin mingw x64_mingw]
23
+
24
+ gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw]
data/NEWS.md CHANGED
@@ -5,10 +5,70 @@ upgrade guides.
5
5
 
6
6
  User-visible changes worth mentioning.
7
7
 
8
- ## 5.0.3
8
+ ## master
9
9
 
10
- [#1371] Backport: Add #as_json method and attributes serialization restriction for Application model.
11
- Fixes information disclosure vulnerability (CVE-2020-10187).
10
+ - [#PR] Add your PR description here.
11
+
12
+ ## 5.1.0
13
+
14
+ - [#1243]: Add nil check operator in token checking at token introspection.
15
+ - [#1241] Explaining foreign key options for resource owner in a single place
16
+ - [#1237] Allow to set blank redirect URI if Doorkeeper configured to use redirect URI-less grant flows.
17
+ - [#1234] Fix `StaleRecordsCleaner` to properly work with big amount of records.
18
+ - [#1228] Allow to explicitly set non-expiring tokens in `custom_access_token_expires_in` configuration
19
+ option using `Float::INIFINITY` return value.
20
+ - [#1224] Do not try to store token if not found by fallback hashing strategy.
21
+ - [#1223] Update Hound/Rubocop rules, correct Doorkeeper codebase to follow style-guides.
22
+ - [#1220] Drop Rails 4.2 & Ruby < 2.4 support.
23
+
24
+ ## 5.1.0.rc2
25
+
26
+ - [#1208] Unify hashing implementation into secret storing strategies
27
+
28
+ **[IMPORTANT]**: If you have been using the master branch of doorkeeper with bcrypt in your Gemfile.lock,
29
+ your application secrets have been hashed using BCrypt. To restore this behavior, use the initializer option
30
+ `use_application_hashing using: 'Doorkeeper::SecretStoring::BCrypt`.
31
+
32
+ - [#1216] Add nil check to `expires_at` method.
33
+ - [#1215] Fix deprecates for Rails 6.
34
+ - [#1214] Scopes field accepts array.
35
+ - [#1209] Fix tokens validation for Token Introspection request.
36
+ - [#1202] Use correct HTTP status codes for error responses.
37
+
38
+ **[IMPORTANT]**: this change might break your application if you were relying on the previous
39
+ 401 status codes, this is now a 400 by default, or a 401 for `invalid_client` and `invalid_token` errors.
40
+
41
+ - [#1201] Fix custom TTL block `client` parameter to always be an `Doorkeeper::Application` instance.
42
+
43
+ **[IMPORTANT]**: those who defined `custom_access_token_expires_in` configuration option need to check
44
+ their block implementation: if you are using `oauth_client.application` to get `Doorkeeper::Application`
45
+ instance, then you need to replace it with just `oauth_client`.
46
+
47
+ - [#1200] Increase default Doorkeeper access token value complexity (`urlsafe_base64` instead of just `hex`)
48
+ matching RFC6749/RFC6750.
49
+
50
+ **[IMPORTANT]**: this change have possible side-effects in case you have custom database constraints for
51
+ access token value, application secrets, refresh tokens or you patched Doorkeeper models and introduced
52
+ token value validations, or you are using database with case-insensitive WHERE clause like MySQL
53
+ (you can face some collisions). Before this change access token value matched `[a-f0-9]` regex, and now
54
+ it matches `[a-zA-Z0-9\-_]`. In case you have such restrictions and your don't use custom token generator
55
+ please change configuration option `default_generator_method ` to `:hex`.
56
+
57
+ - [#1195] Allow to customize Token Introspection response (fixes #1194).
58
+ - [#1189] Option to set `token_reuse_limit`.
59
+ - [#1191] Try to load bcrypt for hashing of application secrets, but add fallback.
60
+
61
+ ## 5.1.0.rc1
62
+
63
+ - [#1188] Use `params` instead of `request.POST` in tokens controller (fixes #1183).
64
+ - [#1182] Fix loopback IP redirect URIs to conform with RFC8252, p. 7.3 (fixes #1170).
65
+ - [#1179] Authorization Code Grant Flow without client id returns invalid_client error.
66
+ - [#1177] Allow to limit `scopes` for certain `grant_types`
67
+ - [#1176] Fix test factory support for `factory_bot_rails`
68
+ - [#1175] Internal refactor: use `scopes_string` inside `scopes`.
69
+ - [#1168] Allow optional hashing of tokens and secrets.
70
+ - [#1164] Fix error when `root_path` is not defined.
71
+ - [#1162] Fix `enforce_content_type` for requests without body.
12
72
 
13
73
  ## 5.0.2
14
74
 
@@ -17,13 +77,13 @@ User-visible changes worth mentioning.
17
77
 
18
78
  ## 5.0.1
19
79
 
80
+ - [#1154] Refactor `StaleRecordsCleaner` to be ORM agnostic.
81
+ - [#1152] Fix migration template: change resource owner data type from integer to Rails generic `references`
82
+ - [#1151] Fix Refresh Token strategy: add proper validation of client credentials both for Public & Private clients.
83
+ - [#1149] Fix for `URIChecker#valid_for_authorization?` false negative when query is blank, but `?` present.
20
84
  - [#1140] Allow rendering custom errors from exceptions (issue #844). Originally opened as [#944].
21
85
  - [#1138] Revert regression bug (check for token expiration in Authorizations controller so authorization
22
86
  triggers every time)
23
- - [#1149] Fix for `URIChecker#valid_for_authorization?` false negative when query is blank, but `?` present.
24
- - [#1151] Fix Refresh Token strategy: add proper validation of client credentials both for Public & Private clients.
25
- - [#1152] Fix migration template: change resource owner data type from integer to Rails generic `references`
26
- - [#1154] Refactor `StaleRecordsCleaner` to be ORM agnostic.
27
87
 
28
88
  ## 5.0.0
29
89
 
@@ -31,14 +91,14 @@ User-visible changes worth mentioning.
31
91
 
32
92
  ## 5.0.0.rc2
33
93
 
34
- - [#1106] Restrict access to AdminController with 'Forbidden 403' if admin_authenticator is not
35
- configured by developers..
36
- - [#1108] Simple formating of callback URLs when listing oauth applications
94
+ - [#1122] Fix AuthorizationsController#new error response to be in JSON format
95
+ - [#1119] Fix token revocation for OAuth apps using "implicit" grant flow
37
96
  - [#1116] `AccessGrant`s will now be revoked along with `AccessToken`s when
38
97
  hitting the `AuthorizedApplicationController#destroy` route.
39
98
  - [#1114] Make token info endpoint's attributes consistent with token creation
40
- - [#1119] Fix token revocation for OAuth apps using "implicit" grant flow
41
- - [#1122] Fix AuthorizationsController#new error response to be in JSON format
99
+ - [#1108] Simple formating of callback URLs when listing oauth applications
100
+ - [#1106] Restrict access to AdminController with 'Forbidden 403' if admin_authenticator is not
101
+ configured by developers.
42
102
 
43
103
  ## 5.0.0.rc1
44
104
 
@@ -59,12 +119,12 @@ User-visible changes worth mentioning.
59
119
  `Doorkeeper#installed?` method
60
120
  - [#1031] Allow public clients to authenticate without `client_secret`. Define an app as
61
121
  either public or private/confidential
62
-
122
+
63
123
  **[IMPORTANT]**: all the applications (clients) now are considered as private by default.
64
124
  You need to manually change `confidential` column to `false` if you are using public clients,
65
125
  in other case your mobile (or other) applications will not be able to authorize.
66
126
  See [#1142](https://github.com/doorkeeper-gem/doorkeeper/issues/1142) for more details.
67
-
127
+
68
128
  - [#1010] Add configuration to enforce configured scopes (`default_scopes` and
69
129
  `optional_scopes`) for applications
70
130
  - [#1060] Ensure that the native redirect_uri parameter matches with redirect_uri of the client
@@ -82,26 +142,26 @@ User-visible changes worth mentioning.
82
142
  - [#1076] Add config to enforce content type to application/x-www-form-urlencoded
83
143
  - Fix bug with `force_ssl_in_redirect_uri` when it breaks existing applications with an
84
144
  SSL redirect_uri.
85
-
145
+
86
146
  ## 4.4.3
87
-
147
+
88
148
  - [#1143] Adds a config option `opt_out_native_route_change` to opt out of the breaking api
89
149
  changed introduced in https://github.com/doorkeeper-gem/doorkeeper/pull/1003
90
150
 
91
-
151
+
92
152
  ## 4.4.2
93
153
 
94
154
  - [#1130] Backport fix for native redirect_uri from 5.x.
95
-
155
+
96
156
  ## 4.4.1
97
157
 
98
158
  - [#1127] Backport token type to comply with the RFC6750 specification.
99
159
  - [#1125] Backport Quote surround I18n yes/no keys
100
-
160
+
101
161
  ## 4.4.0
102
-
162
+
103
163
  - [#1120] Backport security fix from 5.x for token revocation when using public clients
104
-
164
+
105
165
  **[IMPORTANT]**: all the applications (clients) now are considered as private by default.
106
166
  You need to manually change `confidential` column to `false` if you are using public clients,
107
167
  in other case your mobile (or other) applications will not be able to authorize.