doorkeeper 5.2.6 → 5.3.0

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 (126) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +2 -2
  3. data/CHANGELOG.md +15 -14
  4. data/Gemfile +2 -2
  5. data/app/controllers/doorkeeper/application_controller.rb +2 -2
  6. data/app/controllers/doorkeeper/application_metal_controller.rb +2 -2
  7. data/app/controllers/doorkeeper/applications_controller.rb +3 -3
  8. data/app/controllers/doorkeeper/authorizations_controller.rb +2 -2
  9. data/app/controllers/doorkeeper/authorized_applications_controller.rb +3 -3
  10. data/gemfiles/rails_5_0.gemfile +2 -2
  11. data/gemfiles/rails_5_1.gemfile +2 -2
  12. data/gemfiles/rails_5_2.gemfile +2 -2
  13. data/gemfiles/rails_6_0.gemfile +2 -2
  14. data/gemfiles/rails_master.gemfile +2 -2
  15. data/lib/doorkeeper.rb +2 -3
  16. data/lib/doorkeeper/config.rb +71 -39
  17. data/lib/doorkeeper/grape/helpers.rb +1 -1
  18. data/lib/doorkeeper/helpers/controller.rb +10 -8
  19. data/lib/doorkeeper/models/access_grant_mixin.rb +7 -6
  20. data/lib/doorkeeper/models/access_token_mixin.rb +55 -18
  21. data/lib/doorkeeper/models/application_mixin.rb +3 -3
  22. data/lib/doorkeeper/models/concerns/ownership.rb +1 -1
  23. data/lib/doorkeeper/models/concerns/reusable.rb +1 -1
  24. data/lib/doorkeeper/models/concerns/revocable.rb +0 -27
  25. data/lib/doorkeeper/oauth/authorization/code.rb +4 -4
  26. data/lib/doorkeeper/oauth/authorization/token.rb +9 -6
  27. data/lib/doorkeeper/oauth/authorization_code_request.rb +13 -6
  28. data/lib/doorkeeper/oauth/base_request.rb +8 -4
  29. data/lib/doorkeeper/oauth/client.rb +7 -8
  30. data/lib/doorkeeper/oauth/client_credentials/creator.rb +16 -9
  31. data/lib/doorkeeper/oauth/client_credentials/issuer.rb +7 -7
  32. data/lib/doorkeeper/oauth/client_credentials/{validation.rb → validator.rb} +4 -4
  33. data/lib/doorkeeper/oauth/client_credentials_request.rb +1 -1
  34. data/lib/doorkeeper/oauth/code_response.rb +2 -2
  35. data/lib/doorkeeper/oauth/error.rb +1 -1
  36. data/lib/doorkeeper/oauth/error_response.rb +5 -5
  37. data/lib/doorkeeper/oauth/helpers/scope_checker.rb +7 -5
  38. data/lib/doorkeeper/oauth/helpers/unique_token.rb +8 -5
  39. data/lib/doorkeeper/oauth/helpers/uri_checker.rb +1 -1
  40. data/lib/doorkeeper/oauth/invalid_request_response.rb +3 -3
  41. data/lib/doorkeeper/oauth/invalid_token_response.rb +5 -2
  42. data/lib/doorkeeper/oauth/password_access_token_request.rb +3 -3
  43. data/lib/doorkeeper/oauth/pre_authorization.rb +7 -5
  44. data/lib/doorkeeper/oauth/refresh_token_request.rb +5 -5
  45. data/lib/doorkeeper/oauth/token.rb +2 -2
  46. data/lib/doorkeeper/oauth/token_introspection.rb +6 -6
  47. data/lib/doorkeeper/orm/active_record.rb +3 -3
  48. data/lib/doorkeeper/orm/active_record/access_grant.rb +4 -43
  49. data/lib/doorkeeper/orm/active_record/access_token.rb +4 -35
  50. data/lib/doorkeeper/orm/active_record/application.rb +3 -155
  51. data/lib/doorkeeper/orm/active_record/mixins/access_grant.rb +53 -0
  52. data/lib/doorkeeper/orm/active_record/mixins/access_token.rb +47 -0
  53. data/lib/doorkeeper/orm/active_record/mixins/application.rb +128 -0
  54. data/lib/doorkeeper/orm/active_record/redirect_uri_validator.rb +3 -3
  55. data/lib/doorkeeper/rails/helpers.rb +4 -4
  56. data/lib/doorkeeper/rails/routes.rb +5 -7
  57. data/lib/doorkeeper/rake/db.rake +3 -3
  58. data/lib/doorkeeper/request.rb +1 -1
  59. data/lib/doorkeeper/request/authorization_code.rb +3 -3
  60. data/lib/doorkeeper/request/client_credentials.rb +2 -2
  61. data/lib/doorkeeper/request/password.rb +2 -2
  62. data/lib/doorkeeper/request/refresh_token.rb +3 -3
  63. data/lib/doorkeeper/server.rb +1 -1
  64. data/lib/doorkeeper/stale_records_cleaner.rb +1 -1
  65. data/lib/doorkeeper/version.rb +2 -2
  66. data/lib/generators/doorkeeper/application_owner_generator.rb +1 -1
  67. data/lib/generators/doorkeeper/confidential_applications_generator.rb +1 -1
  68. data/lib/generators/doorkeeper/migration_generator.rb +1 -1
  69. data/lib/generators/doorkeeper/pkce_generator.rb +1 -1
  70. data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +2 -2
  71. data/lib/generators/doorkeeper/templates/initializer.rb +39 -8
  72. data/spec/controllers/application_metal_controller_spec.rb +1 -1
  73. data/spec/controllers/applications_controller_spec.rb +3 -2
  74. data/spec/controllers/authorizations_controller_spec.rb +18 -18
  75. data/spec/controllers/protected_resources_controller_spec.rb +25 -17
  76. data/spec/controllers/token_info_controller_spec.rb +1 -1
  77. data/spec/controllers/tokens_controller_spec.rb +1 -1
  78. data/spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb +3 -3
  79. data/spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb +1 -1
  80. data/spec/dummy/db/migrate/20180210183654_add_confidential_to_applications.rb +1 -1
  81. data/spec/generators/install_generator_spec.rb +1 -1
  82. data/spec/generators/previous_refresh_token_generator_spec.rb +2 -2
  83. data/spec/helpers/doorkeeper/dashboard_helper_spec.rb +1 -1
  84. data/spec/lib/config_spec.rb +61 -21
  85. data/spec/lib/doorkeeper_spec.rb +1 -1
  86. data/spec/lib/models/revocable_spec.rb +3 -3
  87. data/spec/lib/oauth/authorization_code_request_spec.rb +127 -125
  88. data/spec/lib/oauth/base_request_spec.rb +160 -158
  89. data/spec/lib/oauth/base_response_spec.rb +27 -29
  90. data/spec/lib/oauth/client/credentials_spec.rb +1 -1
  91. data/spec/lib/oauth/client_credentials/creator_spec.rb +42 -5
  92. data/spec/lib/oauth/client_credentials/issuer_spec.rb +12 -12
  93. data/spec/lib/oauth/client_credentials/validation_spec.rb +4 -4
  94. data/spec/lib/oauth/client_credentials_integration_spec.rb +16 -18
  95. data/spec/lib/oauth/client_credentials_request_spec.rb +78 -80
  96. data/spec/lib/oauth/client_spec.rb +26 -26
  97. data/spec/lib/oauth/code_request_spec.rb +34 -34
  98. data/spec/lib/oauth/code_response_spec.rb +21 -25
  99. data/spec/lib/oauth/error_response_spec.rb +42 -44
  100. data/spec/lib/oauth/error_spec.rb +12 -14
  101. data/spec/lib/oauth/forbidden_token_response_spec.rb +11 -13
  102. data/spec/lib/oauth/helpers/scope_checker_spec.rb +30 -18
  103. data/spec/lib/oauth/invalid_request_response_spec.rb +48 -50
  104. data/spec/lib/oauth/invalid_token_response_spec.rb +32 -34
  105. data/spec/lib/oauth/password_access_token_request_spec.rb +145 -147
  106. data/spec/lib/oauth/pre_authorization_spec.rb +159 -161
  107. data/spec/lib/oauth/refresh_token_request_spec.rb +138 -139
  108. data/spec/lib/oauth/scopes_spec.rb +104 -106
  109. data/spec/lib/oauth/token_request_spec.rb +115 -111
  110. data/spec/lib/oauth/token_response_spec.rb +71 -73
  111. data/spec/lib/oauth/token_spec.rb +121 -123
  112. data/spec/models/doorkeeper/access_grant_spec.rb +3 -5
  113. data/spec/models/doorkeeper/access_token_spec.rb +7 -7
  114. data/spec/models/doorkeeper/application_spec.rb +295 -373
  115. data/spec/requests/applications/applications_request_spec.rb +1 -1
  116. data/spec/requests/endpoints/authorization_spec.rb +5 -3
  117. data/spec/requests/flows/authorization_code_spec.rb +34 -22
  118. data/spec/requests/flows/client_credentials_spec.rb +1 -1
  119. data/spec/requests/flows/password_spec.rb +32 -12
  120. data/spec/requests/flows/refresh_token_spec.rb +19 -19
  121. data/spec/requests/flows/revoke_token_spec.rb +18 -12
  122. data/spec/spec_helper.rb +1 -4
  123. data/spec/support/shared/controllers_shared_context.rb +33 -23
  124. data/spec/validators/redirect_uri_validator_spec.rb +1 -1
  125. metadata +6 -5
  126. data/spec/support/http_method_shim.rb +0 -29
@@ -29,12 +29,9 @@ end
29
29
 
30
30
  Doorkeeper::RSpec.print_configuration_info
31
31
 
32
- # Remove after dropping support of Rails 4.2
33
- require "#{File.dirname(__FILE__)}/support/http_method_shim"
34
-
35
32
  require "support/orm/#{DOORKEEPER_ORM}"
36
33
 
37
- Dir["#{File.dirname(__FILE__)}/support/{dependencies,helpers,shared}/*.rb"].each { |file| require file }
34
+ Dir["#{File.dirname(__FILE__)}/support/{dependencies,helpers,shared}/*.rb"].sort.each { |file| require file }
38
35
 
39
36
  RSpec.configure do |config|
40
37
  config.infer_spec_type_from_file_location!
@@ -4,14 +4,16 @@ shared_context "valid token", token: :valid do
4
4
  let(:token_string) { "1A2B3C4D" }
5
5
 
6
6
  let :token do
7
- double(Doorkeeper::AccessToken,
8
- accessible?: true, includes_scope?: true, acceptable?: true,
9
- previous_refresh_token: "", revoke_previous_refresh_token!: true)
7
+ double(
8
+ Doorkeeper::AccessToken,
9
+ accessible?: true, includes_scope?: true, acceptable?: true,
10
+ previous_refresh_token: "", revoke_previous_refresh_token!: true,
11
+ )
10
12
  end
11
13
 
12
14
  before :each do
13
15
  allow(
14
- Doorkeeper::AccessToken
16
+ Doorkeeper::AccessToken,
15
17
  ).to receive(:by_token).with(token_string).and_return(token)
16
18
  end
17
19
  end
@@ -20,15 +22,17 @@ shared_context "invalid token", token: :invalid do
20
22
  let(:token_string) { "1A2B3C4D" }
21
23
 
22
24
  let :token do
23
- double(Doorkeeper::AccessToken,
24
- accessible?: false, revoked?: false, expired?: false,
25
- includes_scope?: false, acceptable?: false,
26
- previous_refresh_token: "", revoke_previous_refresh_token!: true)
25
+ double(
26
+ Doorkeeper::AccessToken,
27
+ accessible?: false, revoked?: false, expired?: false,
28
+ includes_scope?: false, acceptable?: false,
29
+ previous_refresh_token: "", revoke_previous_refresh_token!: true,
30
+ )
27
31
  end
28
32
 
29
33
  before :each do
30
34
  allow(
31
- Doorkeeper::AccessToken
35
+ Doorkeeper::AccessToken,
32
36
  ).to receive(:by_token).with(token_string).and_return(token)
33
37
  end
34
38
  end
@@ -72,15 +76,17 @@ shared_context "expired token", token: :expired do
72
76
  end
73
77
 
74
78
  let :token do
75
- double(Doorkeeper::AccessToken,
76
- accessible?: false, revoked?: false, expired?: true,
77
- includes_scope?: false, acceptable?: false,
78
- previous_refresh_token: "", revoke_previous_refresh_token!: true)
79
+ double(
80
+ Doorkeeper::AccessToken,
81
+ accessible?: false, revoked?: false, expired?: true,
82
+ includes_scope?: false, acceptable?: false,
83
+ previous_refresh_token: "", revoke_previous_refresh_token!: true,
84
+ )
79
85
  end
80
86
 
81
87
  before :each do
82
88
  allow(
83
- Doorkeeper::AccessToken
89
+ Doorkeeper::AccessToken,
84
90
  ).to receive(:by_token).with(token_string).and_return(token)
85
91
  end
86
92
  end
@@ -91,15 +97,17 @@ shared_context "revoked token", token: :revoked do
91
97
  end
92
98
 
93
99
  let :token do
94
- double(Doorkeeper::AccessToken,
95
- accessible?: false, revoked?: true, expired?: false,
96
- includes_scope?: false, acceptable?: false,
97
- previous_refresh_token: "", revoke_previous_refresh_token!: true)
100
+ double(
101
+ Doorkeeper::AccessToken,
102
+ accessible?: false, revoked?: true, expired?: false,
103
+ includes_scope?: false, acceptable?: false,
104
+ previous_refresh_token: "", revoke_previous_refresh_token!: true,
105
+ )
98
106
  end
99
107
 
100
108
  before :each do
101
109
  allow(
102
- Doorkeeper::AccessToken
110
+ Doorkeeper::AccessToken,
103
111
  ).to receive(:by_token).with(token_string).and_return(token)
104
112
  end
105
113
  end
@@ -110,14 +118,16 @@ shared_context "forbidden token", token: :forbidden do
110
118
  end
111
119
 
112
120
  let :token do
113
- double(Doorkeeper::AccessToken,
114
- accessible?: true, includes_scope?: true, acceptable?: false,
115
- previous_refresh_token: "", revoke_previous_refresh_token!: true)
121
+ double(
122
+ Doorkeeper::AccessToken,
123
+ accessible?: true, includes_scope?: true, acceptable?: false,
124
+ previous_refresh_token: "", revoke_previous_refresh_token!: true,
125
+ )
116
126
  end
117
127
 
118
128
  before :each do
119
129
  allow(
120
- Doorkeeper::AccessToken
130
+ Doorkeeper::AccessToken,
121
131
  ).to receive(:by_token).with(token_string).and_return(token)
122
132
  end
123
133
  end
@@ -100,7 +100,7 @@ describe Doorkeeper::RedirectUriValidator do
100
100
  it "accepts a non secured protocol when disabled" do
101
101
  subject.redirect_uri = "http://example.com/callback"
102
102
  allow(Doorkeeper.configuration).to receive(
103
- :force_ssl_in_redirect_uri
103
+ :force_ssl_in_redirect_uri,
104
104
  ).and_return(false)
105
105
  expect(subject).to be_valid
106
106
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.6
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Elias Philipp
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-05-07 00:00:00.000000000 Z
14
+ date: 2020-01-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: railties
@@ -250,7 +250,7 @@ files:
250
250
  - lib/doorkeeper/oauth/client/credentials.rb
251
251
  - lib/doorkeeper/oauth/client_credentials/creator.rb
252
252
  - lib/doorkeeper/oauth/client_credentials/issuer.rb
253
- - lib/doorkeeper/oauth/client_credentials/validation.rb
253
+ - lib/doorkeeper/oauth/client_credentials/validator.rb
254
254
  - lib/doorkeeper/oauth/client_credentials_request.rb
255
255
  - lib/doorkeeper/oauth/code_request.rb
256
256
  - lib/doorkeeper/oauth/code_response.rb
@@ -275,6 +275,9 @@ files:
275
275
  - lib/doorkeeper/orm/active_record/access_grant.rb
276
276
  - lib/doorkeeper/orm/active_record/access_token.rb
277
277
  - lib/doorkeeper/orm/active_record/application.rb
278
+ - lib/doorkeeper/orm/active_record/mixins/access_grant.rb
279
+ - lib/doorkeeper/orm/active_record/mixins/access_token.rb
280
+ - lib/doorkeeper/orm/active_record/mixins/application.rb
278
281
  - lib/doorkeeper/orm/active_record/redirect_uri_validator.rb
279
282
  - lib/doorkeeper/orm/active_record/stale_records_cleaner.rb
280
283
  - lib/doorkeeper/rails/helpers.rb
@@ -444,7 +447,6 @@ files:
444
447
  - spec/support/helpers/model_helper.rb
445
448
  - spec/support/helpers/request_spec_helper.rb
446
449
  - spec/support/helpers/url_helper.rb
447
- - spec/support/http_method_shim.rb
448
450
  - spec/support/orm/active_record.rb
449
451
  - spec/support/shared/controllers_shared_context.rb
450
452
  - spec/support/shared/hashing_shared_context.rb
@@ -611,7 +613,6 @@ test_files:
611
613
  - spec/support/helpers/model_helper.rb
612
614
  - spec/support/helpers/request_spec_helper.rb
613
615
  - spec/support/helpers/url_helper.rb
614
- - spec/support/http_method_shim.rb
615
616
  - spec/support/orm/active_record.rb
616
617
  - spec/support/shared/controllers_shared_context.rb
617
618
  - spec/support/shared/hashing_shared_context.rb
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Rails 5 deprecates calling HTTP action methods with positional arguments
4
- # in favor of keyword arguments. However, the keyword argument form is only
5
- # supported in Rails 5+. Since we support back to 4, we need some sort of shim
6
- # to avoid super noisy deprecations when running tests.
7
- module RoutingHTTPMethodShim
8
- def get(path, **args)
9
- super(path, args[:params], args[:headers])
10
- end
11
-
12
- def post(path, **args)
13
- super(path, args[:params], args[:headers])
14
- end
15
-
16
- def put(path, **args)
17
- super(path, args[:params], args[:headers])
18
- end
19
- end
20
-
21
- module ControllerHTTPMethodShim
22
- def process(action, http_method = "GET", **args)
23
- if (as = args.delete(:as))
24
- @request.headers["Content-Type"] = Mime[as].to_s
25
- end
26
-
27
- super(action, http_method, args[:params], args[:session], args[:flash])
28
- end
29
- end