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.
- checksums.yaml +4 -4
- data/Appraisals +2 -2
- data/CHANGELOG.md +15 -14
- data/Gemfile +2 -2
- data/app/controllers/doorkeeper/application_controller.rb +2 -2
- data/app/controllers/doorkeeper/application_metal_controller.rb +2 -2
- data/app/controllers/doorkeeper/applications_controller.rb +3 -3
- data/app/controllers/doorkeeper/authorizations_controller.rb +2 -2
- data/app/controllers/doorkeeper/authorized_applications_controller.rb +3 -3
- data/gemfiles/rails_5_0.gemfile +2 -2
- data/gemfiles/rails_5_1.gemfile +2 -2
- data/gemfiles/rails_5_2.gemfile +2 -2
- data/gemfiles/rails_6_0.gemfile +2 -2
- data/gemfiles/rails_master.gemfile +2 -2
- data/lib/doorkeeper.rb +2 -3
- data/lib/doorkeeper/config.rb +71 -39
- data/lib/doorkeeper/grape/helpers.rb +1 -1
- data/lib/doorkeeper/helpers/controller.rb +10 -8
- data/lib/doorkeeper/models/access_grant_mixin.rb +7 -6
- data/lib/doorkeeper/models/access_token_mixin.rb +55 -18
- data/lib/doorkeeper/models/application_mixin.rb +3 -3
- data/lib/doorkeeper/models/concerns/ownership.rb +1 -1
- data/lib/doorkeeper/models/concerns/reusable.rb +1 -1
- data/lib/doorkeeper/models/concerns/revocable.rb +0 -27
- data/lib/doorkeeper/oauth/authorization/code.rb +4 -4
- data/lib/doorkeeper/oauth/authorization/token.rb +9 -6
- data/lib/doorkeeper/oauth/authorization_code_request.rb +13 -6
- data/lib/doorkeeper/oauth/base_request.rb +8 -4
- data/lib/doorkeeper/oauth/client.rb +7 -8
- data/lib/doorkeeper/oauth/client_credentials/creator.rb +16 -9
- data/lib/doorkeeper/oauth/client_credentials/issuer.rb +7 -7
- data/lib/doorkeeper/oauth/client_credentials/{validation.rb → validator.rb} +4 -4
- data/lib/doorkeeper/oauth/client_credentials_request.rb +1 -1
- data/lib/doorkeeper/oauth/code_response.rb +2 -2
- data/lib/doorkeeper/oauth/error.rb +1 -1
- data/lib/doorkeeper/oauth/error_response.rb +5 -5
- data/lib/doorkeeper/oauth/helpers/scope_checker.rb +7 -5
- data/lib/doorkeeper/oauth/helpers/unique_token.rb +8 -5
- data/lib/doorkeeper/oauth/helpers/uri_checker.rb +1 -1
- data/lib/doorkeeper/oauth/invalid_request_response.rb +3 -3
- data/lib/doorkeeper/oauth/invalid_token_response.rb +5 -2
- data/lib/doorkeeper/oauth/password_access_token_request.rb +3 -3
- data/lib/doorkeeper/oauth/pre_authorization.rb +7 -5
- data/lib/doorkeeper/oauth/refresh_token_request.rb +5 -5
- data/lib/doorkeeper/oauth/token.rb +2 -2
- data/lib/doorkeeper/oauth/token_introspection.rb +6 -6
- data/lib/doorkeeper/orm/active_record.rb +3 -3
- data/lib/doorkeeper/orm/active_record/access_grant.rb +4 -43
- data/lib/doorkeeper/orm/active_record/access_token.rb +4 -35
- data/lib/doorkeeper/orm/active_record/application.rb +3 -155
- data/lib/doorkeeper/orm/active_record/mixins/access_grant.rb +53 -0
- data/lib/doorkeeper/orm/active_record/mixins/access_token.rb +47 -0
- data/lib/doorkeeper/orm/active_record/mixins/application.rb +128 -0
- data/lib/doorkeeper/orm/active_record/redirect_uri_validator.rb +3 -3
- data/lib/doorkeeper/rails/helpers.rb +4 -4
- data/lib/doorkeeper/rails/routes.rb +5 -7
- data/lib/doorkeeper/rake/db.rake +3 -3
- data/lib/doorkeeper/request.rb +1 -1
- data/lib/doorkeeper/request/authorization_code.rb +3 -3
- data/lib/doorkeeper/request/client_credentials.rb +2 -2
- data/lib/doorkeeper/request/password.rb +2 -2
- data/lib/doorkeeper/request/refresh_token.rb +3 -3
- data/lib/doorkeeper/server.rb +1 -1
- data/lib/doorkeeper/stale_records_cleaner.rb +1 -1
- data/lib/doorkeeper/version.rb +2 -2
- data/lib/generators/doorkeeper/application_owner_generator.rb +1 -1
- data/lib/generators/doorkeeper/confidential_applications_generator.rb +1 -1
- data/lib/generators/doorkeeper/migration_generator.rb +1 -1
- data/lib/generators/doorkeeper/pkce_generator.rb +1 -1
- data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +2 -2
- data/lib/generators/doorkeeper/templates/initializer.rb +39 -8
- data/spec/controllers/application_metal_controller_spec.rb +1 -1
- data/spec/controllers/applications_controller_spec.rb +3 -2
- data/spec/controllers/authorizations_controller_spec.rb +18 -18
- data/spec/controllers/protected_resources_controller_spec.rb +25 -17
- data/spec/controllers/token_info_controller_spec.rb +1 -1
- data/spec/controllers/tokens_controller_spec.rb +1 -1
- data/spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb +3 -3
- data/spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb +1 -1
- data/spec/dummy/db/migrate/20180210183654_add_confidential_to_applications.rb +1 -1
- data/spec/generators/install_generator_spec.rb +1 -1
- data/spec/generators/previous_refresh_token_generator_spec.rb +2 -2
- data/spec/helpers/doorkeeper/dashboard_helper_spec.rb +1 -1
- data/spec/lib/config_spec.rb +61 -21
- data/spec/lib/doorkeeper_spec.rb +1 -1
- data/spec/lib/models/revocable_spec.rb +3 -3
- data/spec/lib/oauth/authorization_code_request_spec.rb +127 -125
- data/spec/lib/oauth/base_request_spec.rb +160 -158
- data/spec/lib/oauth/base_response_spec.rb +27 -29
- data/spec/lib/oauth/client/credentials_spec.rb +1 -1
- data/spec/lib/oauth/client_credentials/creator_spec.rb +42 -5
- data/spec/lib/oauth/client_credentials/issuer_spec.rb +12 -12
- data/spec/lib/oauth/client_credentials/validation_spec.rb +4 -4
- data/spec/lib/oauth/client_credentials_integration_spec.rb +16 -18
- data/spec/lib/oauth/client_credentials_request_spec.rb +78 -80
- data/spec/lib/oauth/client_spec.rb +26 -26
- data/spec/lib/oauth/code_request_spec.rb +34 -34
- data/spec/lib/oauth/code_response_spec.rb +21 -25
- data/spec/lib/oauth/error_response_spec.rb +42 -44
- data/spec/lib/oauth/error_spec.rb +12 -14
- data/spec/lib/oauth/forbidden_token_response_spec.rb +11 -13
- data/spec/lib/oauth/helpers/scope_checker_spec.rb +30 -18
- data/spec/lib/oauth/invalid_request_response_spec.rb +48 -50
- data/spec/lib/oauth/invalid_token_response_spec.rb +32 -34
- data/spec/lib/oauth/password_access_token_request_spec.rb +145 -147
- data/spec/lib/oauth/pre_authorization_spec.rb +159 -161
- data/spec/lib/oauth/refresh_token_request_spec.rb +138 -139
- data/spec/lib/oauth/scopes_spec.rb +104 -106
- data/spec/lib/oauth/token_request_spec.rb +115 -111
- data/spec/lib/oauth/token_response_spec.rb +71 -73
- data/spec/lib/oauth/token_spec.rb +121 -123
- data/spec/models/doorkeeper/access_grant_spec.rb +3 -5
- data/spec/models/doorkeeper/access_token_spec.rb +7 -7
- data/spec/models/doorkeeper/application_spec.rb +295 -373
- data/spec/requests/applications/applications_request_spec.rb +1 -1
- data/spec/requests/endpoints/authorization_spec.rb +5 -3
- data/spec/requests/flows/authorization_code_spec.rb +34 -22
- data/spec/requests/flows/client_credentials_spec.rb +1 -1
- data/spec/requests/flows/password_spec.rb +32 -12
- data/spec/requests/flows/refresh_token_spec.rb +19 -19
- data/spec/requests/flows/revoke_token_spec.rb +18 -12
- data/spec/spec_helper.rb +1 -4
- data/spec/support/shared/controllers_shared_context.rb +33 -23
- data/spec/validators/redirect_uri_validator_spec.rb +1 -1
- metadata +6 -5
- data/spec/support/http_method_shim.rb +0 -29
data/spec/spec_helper.rb
CHANGED
@@ -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(
|
8
|
-
|
9
|
-
|
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(
|
24
|
-
|
25
|
-
|
26
|
-
|
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(
|
76
|
-
|
77
|
-
|
78
|
-
|
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(
|
95
|
-
|
96
|
-
|
97
|
-
|
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(
|
114
|
-
|
115
|
-
|
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.
|
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-
|
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/
|
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
|