doorkeeper 5.3.2 → 5.5.0.rc1
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/CHANGELOG.md +106 -2
- data/README.md +6 -4
- data/app/controllers/doorkeeper/applications_controller.rb +4 -4
- data/app/controllers/doorkeeper/authorizations_controller.rb +32 -12
- data/app/controllers/doorkeeper/authorized_applications_controller.rb +2 -2
- data/app/controllers/doorkeeper/tokens_controller.rb +60 -20
- data/app/views/doorkeeper/applications/_form.html.erb +1 -1
- data/app/views/doorkeeper/applications/show.html.erb +19 -2
- data/config/locales/en.yml +3 -2
- data/lib/doorkeeper.rb +107 -79
- data/lib/doorkeeper/config.rb +140 -94
- data/lib/doorkeeper/config/abstract_builder.rb +28 -0
- data/lib/doorkeeper/config/option.rb +26 -14
- data/lib/doorkeeper/config/validations.rb +53 -0
- data/lib/doorkeeper/engine.rb +1 -1
- data/lib/doorkeeper/grant_flow.rb +43 -0
- data/lib/doorkeeper/grant_flow/fallback_flow.rb +15 -0
- data/lib/doorkeeper/grant_flow/flow.rb +34 -0
- data/lib/doorkeeper/grant_flow/registry.rb +50 -0
- data/lib/doorkeeper/grape/helpers.rb +1 -1
- data/lib/doorkeeper/helpers/controller.rb +6 -4
- data/lib/doorkeeper/models/access_grant_mixin.rb +20 -16
- data/lib/doorkeeper/models/access_token_mixin.rb +110 -47
- data/lib/doorkeeper/models/application_mixin.rb +5 -4
- data/lib/doorkeeper/models/concerns/resource_ownerable.rb +47 -0
- data/lib/doorkeeper/models/concerns/revocable.rb +1 -1
- data/lib/doorkeeper/models/concerns/scopes.rb +5 -1
- data/lib/doorkeeper/models/concerns/secret_storable.rb +1 -3
- data/lib/doorkeeper/oauth/authorization/code.rb +15 -6
- data/lib/doorkeeper/oauth/authorization/context.rb +5 -5
- data/lib/doorkeeper/oauth/authorization/token.rb +14 -16
- data/lib/doorkeeper/oauth/authorization/uri_builder.rb +4 -4
- data/lib/doorkeeper/oauth/authorization_code_request.rb +17 -14
- data/lib/doorkeeper/oauth/base_request.rb +12 -20
- data/lib/doorkeeper/oauth/client.rb +1 -1
- data/lib/doorkeeper/oauth/client/credentials.rb +2 -4
- data/lib/doorkeeper/oauth/client_credentials/creator.rb +27 -8
- data/lib/doorkeeper/oauth/client_credentials/issuer.rb +4 -2
- data/lib/doorkeeper/oauth/client_credentials/validator.rb +4 -2
- data/lib/doorkeeper/oauth/client_credentials_request.rb +8 -7
- data/lib/doorkeeper/oauth/code_request.rb +3 -3
- data/lib/doorkeeper/oauth/code_response.rb +28 -14
- data/lib/doorkeeper/oauth/error_response.rb +6 -7
- data/lib/doorkeeper/oauth/helpers/scope_checker.rb +2 -8
- data/lib/doorkeeper/oauth/hooks/context.rb +21 -0
- data/lib/doorkeeper/oauth/invalid_token_response.rb +2 -2
- data/lib/doorkeeper/oauth/password_access_token_request.rb +24 -7
- data/lib/doorkeeper/oauth/pre_authorization.rb +41 -31
- data/lib/doorkeeper/oauth/refresh_token_request.rb +31 -22
- data/lib/doorkeeper/oauth/token.rb +5 -6
- data/lib/doorkeeper/oauth/token_introspection.rb +4 -8
- data/lib/doorkeeper/oauth/token_request.rb +3 -3
- data/lib/doorkeeper/oauth/token_response.rb +1 -1
- data/lib/doorkeeper/orm/active_record.rb +10 -2
- data/lib/doorkeeper/orm/active_record/mixins/access_grant.rb +8 -3
- data/lib/doorkeeper/orm/active_record/mixins/access_token.rb +7 -3
- data/lib/doorkeeper/orm/active_record/mixins/application.rb +20 -16
- data/lib/doorkeeper/rails/routes.rb +14 -18
- data/lib/doorkeeper/rails/routes/abstract_router.rb +35 -0
- data/lib/doorkeeper/rails/routes/mapper.rb +2 -2
- data/lib/doorkeeper/rails/routes/registry.rb +45 -0
- data/lib/doorkeeper/request.rb +49 -12
- data/lib/doorkeeper/request/refresh_token.rb +2 -1
- data/lib/doorkeeper/request/strategy.rb +2 -2
- data/lib/doorkeeper/server.rb +4 -4
- data/lib/doorkeeper/stale_records_cleaner.rb +4 -4
- data/lib/doorkeeper/version.rb +3 -3
- data/lib/generators/doorkeeper/confidential_applications_generator.rb +1 -1
- data/lib/generators/doorkeeper/enable_polymorphic_resource_owner_generator.rb +39 -0
- data/lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb.erb +2 -0
- data/lib/generators/doorkeeper/templates/add_previous_refresh_token_to_access_tokens.rb.erb +2 -0
- data/lib/generators/doorkeeper/templates/enable_pkce_migration.rb.erb +2 -0
- data/lib/generators/doorkeeper/templates/enable_polymorphic_resource_owner_migration.rb.erb +17 -0
- data/lib/generators/doorkeeper/templates/initializer.rb +48 -10
- data/lib/generators/doorkeeper/templates/migration.rb.erb +14 -5
- metadata +21 -299
- data/Appraisals +0 -40
- data/CODE_OF_CONDUCT.md +0 -46
- data/CONTRIBUTING.md +0 -49
- data/Dangerfile +0 -67
- data/Dockerfile +0 -29
- data/Gemfile +0 -25
- data/NEWS.md +0 -1
- data/RELEASING.md +0 -11
- data/Rakefile +0 -28
- data/SECURITY.md +0 -15
- data/UPGRADE.md +0 -2
- data/bin/console +0 -16
- data/doorkeeper.gemspec +0 -42
- data/gemfiles/rails_5_0.gemfile +0 -18
- data/gemfiles/rails_5_1.gemfile +0 -18
- data/gemfiles/rails_5_2.gemfile +0 -18
- data/gemfiles/rails_6_0.gemfile +0 -18
- data/gemfiles/rails_master.gemfile +0 -18
- data/spec/controllers/application_metal_controller_spec.rb +0 -64
- data/spec/controllers/applications_controller_spec.rb +0 -274
- data/spec/controllers/authorizations_controller_spec.rb +0 -608
- data/spec/controllers/protected_resources_controller_spec.rb +0 -361
- data/spec/controllers/token_info_controller_spec.rb +0 -50
- data/spec/controllers/tokens_controller_spec.rb +0 -498
- data/spec/dummy/Rakefile +0 -9
- data/spec/dummy/app/assets/config/manifest.js +0 -2
- data/spec/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/dummy/app/controllers/custom_authorizations_controller.rb +0 -9
- data/spec/dummy/app/controllers/full_protected_resources_controller.rb +0 -14
- data/spec/dummy/app/controllers/home_controller.rb +0 -18
- data/spec/dummy/app/controllers/metal_controller.rb +0 -13
- data/spec/dummy/app/controllers/semi_protected_resources_controller.rb +0 -13
- data/spec/dummy/app/helpers/application_helper.rb +0 -7
- data/spec/dummy/app/models/user.rb +0 -7
- data/spec/dummy/app/views/home/index.html.erb +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/config.ru +0 -6
- data/spec/dummy/config/application.rb +0 -49
- data/spec/dummy/config/boot.rb +0 -7
- data/spec/dummy/config/database.yml +0 -15
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -31
- data/spec/dummy/config/environments/production.rb +0 -64
- data/spec/dummy/config/environments/test.rb +0 -45
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -9
- data/spec/dummy/config/initializers/doorkeeper.rb +0 -166
- data/spec/dummy/config/initializers/secret_token.rb +0 -10
- data/spec/dummy/config/initializers/session_store.rb +0 -10
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -16
- data/spec/dummy/config/locales/doorkeeper.en.yml +0 -5
- data/spec/dummy/config/routes.rb +0 -13
- data/spec/dummy/db/migrate/20111122132257_create_users.rb +0 -11
- data/spec/dummy/db/migrate/20120312140401_add_password_to_users.rb +0 -7
- data/spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb +0 -69
- data/spec/dummy/db/migrate/20151223200000_add_owner_to_application.rb +0 -9
- data/spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb +0 -13
- data/spec/dummy/db/migrate/20170822064514_enable_pkce.rb +0 -8
- data/spec/dummy/db/migrate/20180210183654_add_confidential_to_applications.rb +0 -13
- data/spec/dummy/db/schema.rb +0 -68
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -26
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +0 -9
- data/spec/factories.rb +0 -30
- data/spec/generators/application_owner_generator_spec.rb +0 -28
- data/spec/generators/confidential_applications_generator_spec.rb +0 -29
- data/spec/generators/install_generator_spec.rb +0 -36
- data/spec/generators/migration_generator_spec.rb +0 -28
- data/spec/generators/pkce_generator_spec.rb +0 -28
- data/spec/generators/previous_refresh_token_generator_spec.rb +0 -44
- data/spec/generators/templates/routes.rb +0 -4
- data/spec/generators/views_generator_spec.rb +0 -29
- data/spec/grape/grape_integration_spec.rb +0 -137
- data/spec/helpers/doorkeeper/dashboard_helper_spec.rb +0 -26
- data/spec/lib/config_spec.rb +0 -809
- data/spec/lib/doorkeeper_spec.rb +0 -27
- data/spec/lib/models/expirable_spec.rb +0 -61
- data/spec/lib/models/reusable_spec.rb +0 -40
- data/spec/lib/models/revocable_spec.rb +0 -59
- data/spec/lib/models/scopes_spec.rb +0 -53
- data/spec/lib/models/secret_storable_spec.rb +0 -135
- data/spec/lib/oauth/authorization/uri_builder_spec.rb +0 -39
- data/spec/lib/oauth/authorization_code_request_spec.rb +0 -170
- data/spec/lib/oauth/base_request_spec.rb +0 -224
- data/spec/lib/oauth/base_response_spec.rb +0 -45
- data/spec/lib/oauth/client/credentials_spec.rb +0 -90
- data/spec/lib/oauth/client_credentials/creator_spec.rb +0 -134
- data/spec/lib/oauth/client_credentials/issuer_spec.rb +0 -112
- data/spec/lib/oauth/client_credentials/validation_spec.rb +0 -59
- data/spec/lib/oauth/client_credentials_integration_spec.rb +0 -27
- data/spec/lib/oauth/client_credentials_request_spec.rb +0 -107
- data/spec/lib/oauth/client_spec.rb +0 -38
- data/spec/lib/oauth/code_request_spec.rb +0 -46
- data/spec/lib/oauth/code_response_spec.rb +0 -32
- data/spec/lib/oauth/error_response_spec.rb +0 -64
- data/spec/lib/oauth/error_spec.rb +0 -21
- data/spec/lib/oauth/forbidden_token_response_spec.rb +0 -20
- data/spec/lib/oauth/helpers/scope_checker_spec.rb +0 -110
- data/spec/lib/oauth/helpers/unique_token_spec.rb +0 -21
- data/spec/lib/oauth/helpers/uri_checker_spec.rb +0 -262
- data/spec/lib/oauth/invalid_request_response_spec.rb +0 -73
- data/spec/lib/oauth/invalid_token_response_spec.rb +0 -53
- data/spec/lib/oauth/password_access_token_request_spec.rb +0 -190
- data/spec/lib/oauth/pre_authorization_spec.rb +0 -223
- data/spec/lib/oauth/refresh_token_request_spec.rb +0 -177
- data/spec/lib/oauth/scopes_spec.rb +0 -146
- data/spec/lib/oauth/token_request_spec.rb +0 -157
- data/spec/lib/oauth/token_response_spec.rb +0 -84
- data/spec/lib/oauth/token_spec.rb +0 -156
- data/spec/lib/request/strategy_spec.rb +0 -54
- data/spec/lib/secret_storing/base_spec.rb +0 -60
- data/spec/lib/secret_storing/bcrypt_spec.rb +0 -49
- data/spec/lib/secret_storing/plain_spec.rb +0 -44
- data/spec/lib/secret_storing/sha256_hash_spec.rb +0 -48
- data/spec/lib/server_spec.rb +0 -49
- data/spec/lib/stale_records_cleaner_spec.rb +0 -89
- data/spec/models/doorkeeper/access_grant_spec.rb +0 -161
- data/spec/models/doorkeeper/access_token_spec.rb +0 -622
- data/spec/models/doorkeeper/application_spec.rb +0 -482
- data/spec/requests/applications/applications_request_spec.rb +0 -259
- data/spec/requests/applications/authorized_applications_spec.rb +0 -32
- data/spec/requests/endpoints/authorization_spec.rb +0 -91
- data/spec/requests/endpoints/token_spec.rb +0 -75
- data/spec/requests/flows/authorization_code_errors_spec.rb +0 -79
- data/spec/requests/flows/authorization_code_spec.rb +0 -525
- data/spec/requests/flows/client_credentials_spec.rb +0 -166
- data/spec/requests/flows/implicit_grant_errors_spec.rb +0 -46
- data/spec/requests/flows/implicit_grant_spec.rb +0 -91
- data/spec/requests/flows/password_spec.rb +0 -316
- data/spec/requests/flows/refresh_token_spec.rb +0 -233
- data/spec/requests/flows/revoke_token_spec.rb +0 -157
- data/spec/requests/flows/skip_authorization_spec.rb +0 -66
- data/spec/requests/protected_resources/metal_spec.rb +0 -16
- data/spec/requests/protected_resources/private_api_spec.rb +0 -83
- data/spec/routing/custom_controller_routes_spec.rb +0 -133
- data/spec/routing/default_routes_spec.rb +0 -41
- data/spec/routing/scoped_routes_spec.rb +0 -47
- data/spec/spec_helper.rb +0 -54
- data/spec/spec_helper_integration.rb +0 -4
- data/spec/support/dependencies/factory_bot.rb +0 -4
- data/spec/support/doorkeeper_rspec.rb +0 -22
- data/spec/support/helpers/access_token_request_helper.rb +0 -13
- data/spec/support/helpers/authorization_request_helper.rb +0 -43
- data/spec/support/helpers/config_helper.rb +0 -11
- data/spec/support/helpers/model_helper.rb +0 -78
- data/spec/support/helpers/request_spec_helper.rb +0 -110
- data/spec/support/helpers/url_helper.rb +0 -62
- data/spec/support/orm/active_record.rb +0 -5
- data/spec/support/shared/controllers_shared_context.rb +0 -133
- data/spec/support/shared/hashing_shared_context.rb +0 -36
- data/spec/support/shared/models_shared_examples.rb +0 -54
- data/spec/validators/redirect_uri_validator_spec.rb +0 -183
- data/spec/version/version_spec.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1099136de2b2fe0f0443f88bdbe2260ebed52efb2aab31d1d35bb7aa9f801acd
|
4
|
+
data.tar.gz: '09837820494b55d6bd26e2d997c203b221bc7951e74a6d1e2197122a86f0f1b2'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9197207fe8db140d8658aa12cd7422bfd84a001227a9f0841ebf5d92da4be531cfd7dea26aad584fff3573bc066b8fadc4e9d4e70bcc6dd5978253d94a9d66a4
|
7
|
+
data.tar.gz: 3b37c794027fcdbec12ef314bd6a927e111c2aed2044f3ead9f05893400e7221bf9adf98203efe7a225b395d5644326b943c144c13fb0caeccff5dff20a56ca5
|
data/CHANGELOG.md
CHANGED
@@ -5,9 +5,39 @@ upgrade guides.
|
|
5
5
|
|
6
6
|
User-visible changes worth mentioning.
|
7
7
|
|
8
|
-
##
|
8
|
+
## master
|
9
9
|
|
10
|
-
- [#
|
10
|
+
- [#PR ID] Add your PR description here.
|
11
|
+
|
12
|
+
## 5.5.0.rc1
|
13
|
+
|
14
|
+
- [#1435] Make error response not redirectable when client is unauthorized
|
15
|
+
- [#1426] Ensure ActiveRecord callbacks are executed on token revocation.
|
16
|
+
- [#1407] Remove redundant and complex to support helpers froms tests (`should_have_json`, etc).
|
17
|
+
- [#1416] Don't add introspection route if token introspection completely disabled.
|
18
|
+
- [#1410] Properly memoize `current_resource_owner` value (consider `nil` and `false` values).
|
19
|
+
- [#1415] Ignore PKCE params for non-PKCE grants.
|
20
|
+
- [#1418] Add ability to register custom OAuth Grant Flows.
|
21
|
+
- [#1420] Require client authentication for Resource Owner Password Grant as stated in OAuth RFC.
|
22
|
+
|
23
|
+
**[IMPORTANT]** you need to create a new OAuth client (`Doorkeeper::Application`) if yoo didn't
|
24
|
+
have it before and use client credentials in HTTP Basic auth if you previously used this grant
|
25
|
+
flow without client authentication. For migration purposes you could enable
|
26
|
+
`skip_client_authentication_for_password_grant` configuration option to `true`, but such behavior
|
27
|
+
(as well as configuration option) would be completely removed in a future version of Doorkeeper.
|
28
|
+
All the users of your provider application now need to include client credentials when they use
|
29
|
+
this grant flow.
|
30
|
+
|
31
|
+
- [#1421] Add Resource Owner instance to authorization hook context for `custom_access_token_expires_in`
|
32
|
+
configuration option to allow resource owner based Access Tokens TTL.
|
33
|
+
|
34
|
+
## 5.4.0
|
35
|
+
|
36
|
+
- [#1404] Make `Doorkeeper::Application#read_attribute_for_serialization` public.
|
37
|
+
|
38
|
+
## 5.4.0.rc2
|
39
|
+
|
40
|
+
- [#1371] Add `#as_json` method and attributes serialization restriction for Application model.
|
11
41
|
Fixes information disclosure vulnerability (CVE-2020-10187).
|
12
42
|
|
13
43
|
**[IMPORTANT]** you need to re-implement `#as_json` method for Doorkeeper Application model
|
@@ -15,6 +45,54 @@ User-visible changes worth mentioning.
|
|
15
45
|
JSON response from /oauth/applications.json or /oauth/authorized_applications.json. This change
|
16
46
|
is a breaking change which restricts serialized attributes to a very small set of columns.
|
17
47
|
|
48
|
+
- [#1395] Fix `NameError: uninitialized constant Doorkeeper::AccessToken` for Rake tasks.
|
49
|
+
- [#1397] Add `as: :doorkeeper_application` on Doorkeeper application form in order to support
|
50
|
+
custom configured application model.
|
51
|
+
- [#1400] Correctly yield the application instance to `allow_grant_flow_for_client?` config
|
52
|
+
option (fixes #1398).
|
53
|
+
- [#1402] Handle trying authorization with client credentials.
|
54
|
+
|
55
|
+
## 5.4.0.rc1
|
56
|
+
- [#1366] Sets expiry of token generated using `refresh_token` to that of original token. (Fixes #1364)
|
57
|
+
- [#1354] Add `authorize_resource_owner_for_client` option to authorize the calling user to access an application.
|
58
|
+
- [#1355] Allow to enable polymorphic Resource Owner association for Access Token & Grant
|
59
|
+
models (`use_polymorphic_resource_owner` configuration option).
|
60
|
+
|
61
|
+
**[IMPORTANT]** Review your custom patches or extensions for Doorkeeper internals if you
|
62
|
+
have such - since now Doorkeeper passes Resource Owner instance to every objects and not
|
63
|
+
just it's ID. See PR description for details.
|
64
|
+
|
65
|
+
- [#1356] Remove duplicated scopes from Access Tokens and Grants on attribute assignment.
|
66
|
+
- [#1357] Fix `Doorkeeper::OAuth::PreAuthorization#as_json` method causing
|
67
|
+
`Stack level too deep` error with AMS (fix #1312).
|
68
|
+
- [#1358] Deprecate `active_record_options` configuration option.
|
69
|
+
- [#1359] Refactor Doorkeeper configuration options DSL to make it easy to reuse it
|
70
|
+
in external extensions.
|
71
|
+
- [#1360] Increase `matching_token_for` lookup size to 10 000 and make it configurable.
|
72
|
+
- [#1371] Fix controllers to use valid classes in case Doorkeeper has custom models configured.
|
73
|
+
- [#1370] Fix revocation response for invalid token and unauthorized requests to conform with RFC 7009 (fixes #1362).
|
74
|
+
|
75
|
+
**[IMPORTANT]** now fully according to RFC 7009 nobody can do a revocation request without `client_id`
|
76
|
+
(for public clients) and `client_secret` (for private clients). Please update your apps to include that
|
77
|
+
info in the revocation request payload.
|
78
|
+
|
79
|
+
- [#1373] Make Doorkeeper routes mapper reusable in extensions.
|
80
|
+
- [#1374] Revoke and issue client credentials token in a transaction with a row lock.
|
81
|
+
- [#1384] Add context object with auth/pre_auth and issued_token for authorization hooks.
|
82
|
+
- [#1387] Add `AccessToken#create_for` and use in `RefreshTokenRequest`.
|
83
|
+
- [#1392] Fix `enable_polymorphic_resource_owner` migration template to have proper index name.
|
84
|
+
- [#1393] Improve Applications #show page with more informative data on client secret and scopes.
|
85
|
+
- [#1394] Use Ruby `autoload` feature to load Doorkeeper files.
|
86
|
+
|
87
|
+
## 5.3.3
|
88
|
+
|
89
|
+
- [#1404] Backport: Make `Doorkeeper::Application#read_attribute_for_serialization` public.
|
90
|
+
|
91
|
+
## 5.3.2
|
92
|
+
|
93
|
+
- [#1371] Backport: add `#as_json` method and attributes serialization restriction for Application model.
|
94
|
+
Fixes information disclosure vulnerability (CVE-2020-10187).
|
95
|
+
|
18
96
|
## 5.3.1
|
19
97
|
|
20
98
|
- [#1360] Backport: Increase `matching_token_for` batch lookup size to 10 000 and make it configurable.
|
@@ -33,6 +111,15 @@ User-visible changes worth mentioning.
|
|
33
111
|
If you were relying on access tokens being revoked once the same client
|
34
112
|
requested a new access token, reenable it with `revoke_previous_client_credentials_token` in Doorkeeper
|
35
113
|
initialization file.
|
114
|
+
|
115
|
+
## 5.2.6
|
116
|
+
|
117
|
+
- [#1404] Backport: Make `Doorkeeper::Application#read_attribute_for_serialization` public.
|
118
|
+
|
119
|
+
## 5.2.5
|
120
|
+
|
121
|
+
- [#1371] Backport: add `#as_json` method and attributes serialization restriction for Application model.
|
122
|
+
Fixes information disclosure vulnerability (CVE-2020-10187).
|
36
123
|
|
37
124
|
## 5.2.4
|
38
125
|
|
@@ -66,6 +153,9 @@ User-visible changes worth mentioning.
|
|
66
153
|
- [#1298] Slice strong params so doesn't error with Rails forms.
|
67
154
|
- [#1300] Limiting access to attributes of pre_authorization.
|
68
155
|
- [#1296] Adding client_id to strong parameters.
|
156
|
+
|
157
|
+
**[IMPORTANT]** `Doorkeeper::Server#client_via_uid` was removed.
|
158
|
+
|
69
159
|
- [#1293] Move ar specific redirect uri validator to ar orm directory.
|
70
160
|
- [#1288] Allow to pass attributes to the `Doorkeeper::OAuth::PreAuthorization#as_json` method to customize
|
71
161
|
the PreAuthorization response.
|
@@ -98,6 +188,15 @@ User-visible changes worth mentioning.
|
|
98
188
|
- [#1248] Return the unhashed Application Secret in the JSON response after creating new application even when `hash_application_secrets` is used.
|
99
189
|
- [#1238] Better support for native app with support for custom scheme and localhost redirection.
|
100
190
|
|
191
|
+
## 5.1.2
|
192
|
+
|
193
|
+
- [#1404] Backport: Make `Doorkeeper::Application#read_attribute_for_serialization` public.
|
194
|
+
|
195
|
+
## 5.1.1
|
196
|
+
|
197
|
+
- [#1371] Backport: add `#as_json` method and attributes serialization restriction for Application model.
|
198
|
+
Fixes information disclosure vulnerability (CVE-2020-10187).
|
199
|
+
|
101
200
|
## 5.1.0
|
102
201
|
|
103
202
|
- [#1243] Add nil check operator in token checking at token introspection.
|
@@ -159,6 +258,11 @@ User-visible changes worth mentioning.
|
|
159
258
|
- [#1164] Fix error when `root_path` is not defined.
|
160
259
|
- [#1162] Fix `enforce_content_type` for requests without body.
|
161
260
|
|
261
|
+
## 5.0.3
|
262
|
+
|
263
|
+
- [#1371] Backport: add `#as_json` method and attributes serialization restriction for Application model.
|
264
|
+
Fixes information disclosure vulnerability (CVE-2020-10187).
|
265
|
+
|
162
266
|
## 5.0.2
|
163
267
|
|
164
268
|
- [#1158] Fix initializer template: change `handle_auth_errors` option
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
[![Coverage Status](https://coveralls.io/repos/github/doorkeeper-gem/doorkeeper/badge.svg?branch=master)](https://coveralls.io/github/doorkeeper-gem/doorkeeper?branch=master)
|
7
7
|
[![Security](https://hakiri.io/github/doorkeeper-gem/doorkeeper/master.svg)](https://hakiri.io/github/doorkeeper-gem/doorkeeper/master)
|
8
8
|
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
|
9
|
-
[![GuardRails badge](https://badges.
|
9
|
+
[![GuardRails badge](https://badges.guardrails.io/doorkeeper-gem/doorkeeper.svg?token=66768ce8f6995814df81f65a2cff40f739f688492704f973e62809e15599bb62)](https://dashboard.guardrails.io/default/gh/doorkeeper-gem/doorkeeper)
|
10
10
|
[![Dependabot](https://img.shields.io/badge/dependabot-enabled-success.svg)](https://dependabot.com)
|
11
11
|
|
12
12
|
Doorkeeper is a gem (Rails engine) that makes it easy to introduce OAuth 2 provider
|
@@ -113,7 +113,7 @@ These applications show how Doorkeeper works and how to integrate with it. Start
|
|
113
113
|
|
114
114
|
| Application | Link |
|
115
115
|
| :--- | :--- |
|
116
|
-
|
|
116
|
+
| OAuth2 Server with Doorkeeper | [doorkeeper-gem/doorkeeper-provider-app](https://github.com/doorkeeper-gem/doorkeeper-provider-app) |
|
117
117
|
| Sinatra Client connected to Provider App | [doorkeeper-gem/doorkeeper-sinatra-client](https://github.com/doorkeeper-gem/doorkeeper-sinatra-client) |
|
118
118
|
| Devise + Omniauth Client | [doorkeeper-gem/doorkeeper-devise-client](https://github.com/doorkeeper-gem/doorkeeper-devise-client) |
|
119
119
|
|
@@ -160,6 +160,9 @@ tests with a specific Rails version:
|
|
160
160
|
BUNDLE_GEMFILE=gemfiles/rails_6_0.gemfile bundle exec rake
|
161
161
|
```
|
162
162
|
|
163
|
+
You can also experiment with the changes using `bin/console`. It uses in-memory SQLite database and default
|
164
|
+
Doorkeeper config, but you can reestablish connection or reconfigure the gem if you need.
|
165
|
+
|
163
166
|
## Contributing
|
164
167
|
|
165
168
|
Want to contribute and don't know where to start? Check out [features we're
|
@@ -168,8 +171,7 @@ create [example
|
|
168
171
|
apps](https://github.com/doorkeeper-gem/doorkeeper/wiki/Example-Applications),
|
169
172
|
integrate the gem with your app and let us know!
|
170
173
|
|
171
|
-
Also, check out our [contributing guidelines
|
172
|
-
page](https://github.com/doorkeeper-gem/doorkeeper/wiki/Contributing).
|
174
|
+
Also, check out our [contributing guidelines page](CONTRIBUTING.md).
|
173
175
|
|
174
176
|
## Contributors
|
175
177
|
|
@@ -8,7 +8,7 @@ module Doorkeeper
|
|
8
8
|
before_action :set_application, only: %i[show edit update destroy]
|
9
9
|
|
10
10
|
def index
|
11
|
-
@applications =
|
11
|
+
@applications = Doorkeeper.config.application_model.ordered_by(:created_at)
|
12
12
|
|
13
13
|
respond_to do |format|
|
14
14
|
format.html
|
@@ -24,11 +24,11 @@ module Doorkeeper
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def new
|
27
|
-
@application =
|
27
|
+
@application = Doorkeeper.config.application_model.new
|
28
28
|
end
|
29
29
|
|
30
30
|
def create
|
31
|
-
@application =
|
31
|
+
@application = Doorkeeper.config.application_model.new(application_params)
|
32
32
|
|
33
33
|
if @application.save
|
34
34
|
flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])
|
@@ -84,7 +84,7 @@ module Doorkeeper
|
|
84
84
|
private
|
85
85
|
|
86
86
|
def set_application
|
87
|
-
@application =
|
87
|
+
@application = Doorkeeper.config.application_model.find(params[:id])
|
88
88
|
end
|
89
89
|
|
90
90
|
def application_params
|
@@ -42,9 +42,9 @@ module Doorkeeper
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def matching_token?
|
45
|
-
|
45
|
+
Doorkeeper.config.access_token_model.matching_token_for(
|
46
46
|
pre_auth.client,
|
47
|
-
current_resource_owner
|
47
|
+
current_resource_owner,
|
48
48
|
pre_auth.scopes,
|
49
49
|
)
|
50
50
|
end
|
@@ -65,7 +65,11 @@ module Doorkeeper
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def pre_auth
|
68
|
-
@pre_auth ||= OAuth::PreAuthorization.new(
|
68
|
+
@pre_auth ||= OAuth::PreAuthorization.new(
|
69
|
+
Doorkeeper.configuration,
|
70
|
+
pre_auth_params,
|
71
|
+
current_resource_owner,
|
72
|
+
)
|
69
73
|
end
|
70
74
|
|
71
75
|
def pre_auth_params
|
@@ -73,8 +77,15 @@ module Doorkeeper
|
|
73
77
|
end
|
74
78
|
|
75
79
|
def pre_auth_param_fields
|
76
|
-
%i[
|
77
|
-
|
80
|
+
%i[
|
81
|
+
client_id
|
82
|
+
code_challenge
|
83
|
+
code_challenge_method
|
84
|
+
response_type
|
85
|
+
redirect_uri
|
86
|
+
scope
|
87
|
+
state
|
88
|
+
]
|
78
89
|
end
|
79
90
|
|
80
91
|
def authorization
|
@@ -82,26 +93,35 @@ module Doorkeeper
|
|
82
93
|
end
|
83
94
|
|
84
95
|
def strategy
|
85
|
-
@strategy ||= server.authorization_request
|
96
|
+
@strategy ||= server.authorization_request(pre_auth.response_type)
|
86
97
|
end
|
87
98
|
|
88
99
|
def authorize_response
|
89
100
|
@authorize_response ||= begin
|
90
101
|
return pre_auth.error_response unless pre_auth.authorizable?
|
91
102
|
|
92
|
-
|
103
|
+
context = build_context(pre_auth: pre_auth)
|
104
|
+
before_successful_authorization(context)
|
105
|
+
|
93
106
|
auth = strategy.authorize
|
94
|
-
|
107
|
+
|
108
|
+
context = build_context(auth: auth)
|
109
|
+
after_successful_authorization(context)
|
110
|
+
|
95
111
|
auth
|
96
112
|
end
|
97
113
|
end
|
98
114
|
|
99
|
-
def
|
100
|
-
Doorkeeper.
|
115
|
+
def build_context(**attributes)
|
116
|
+
Doorkeeper::OAuth::Hooks::Context.new(**attributes)
|
117
|
+
end
|
118
|
+
|
119
|
+
def before_successful_authorization(context = nil)
|
120
|
+
Doorkeeper.config.before_successful_authorization.call(self, context)
|
101
121
|
end
|
102
122
|
|
103
|
-
def
|
104
|
-
Doorkeeper.
|
123
|
+
def after_successful_authorization(context)
|
124
|
+
Doorkeeper.config.after_successful_authorization.call(self, context)
|
105
125
|
end
|
106
126
|
end
|
107
127
|
end
|
@@ -5,7 +5,7 @@ module Doorkeeper
|
|
5
5
|
before_action :authenticate_resource_owner!
|
6
6
|
|
7
7
|
def index
|
8
|
-
@applications =
|
8
|
+
@applications = Doorkeeper.config.application_model.authorized_for(current_resource_owner)
|
9
9
|
|
10
10
|
respond_to do |format|
|
11
11
|
format.html
|
@@ -14,7 +14,7 @@ module Doorkeeper
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def destroy
|
17
|
-
|
17
|
+
Doorkeeper.config.application_model.revoke_tokens_and_grants_for(
|
18
18
|
params[:id],
|
19
19
|
current_resource_owner,
|
20
20
|
)
|
@@ -12,14 +12,41 @@ module Doorkeeper
|
|
12
12
|
|
13
13
|
# OAuth 2.0 Token Revocation - http://tools.ietf.org/html/rfc7009
|
14
14
|
def revoke
|
15
|
-
#
|
16
|
-
# and checks its ownership of the provided token.
|
15
|
+
# @see 2.1. Revocation Request
|
17
16
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
17
|
+
# The client constructs the request by including the following
|
18
|
+
# parameters using the "application/x-www-form-urlencoded" format in
|
19
|
+
# the HTTP request entity-body:
|
20
|
+
# token REQUIRED.
|
21
|
+
# token_type_hint OPTIONAL.
|
22
|
+
#
|
23
|
+
# The client also includes its authentication credentials as described
|
24
|
+
# in Section 2.3. of [RFC6749].
|
25
|
+
#
|
26
|
+
# The authorization server first validates the client credentials (in
|
27
|
+
# case of a confidential client) and then verifies whether the token
|
28
|
+
# was issued to the client making the revocation request.
|
29
|
+
unless server.client
|
30
|
+
# If this validation [client credentials / token ownership] fails, the request is
|
31
|
+
# refused and the client is informed of the error by the authorization server as
|
32
|
+
# described below.
|
33
|
+
#
|
34
|
+
# @see 2.2.1. Error Response
|
35
|
+
#
|
36
|
+
# The error presentation conforms to the definition in Section 5.2 of [RFC6749].
|
37
|
+
render json: revocation_error_response, status: :forbidden
|
38
|
+
return
|
39
|
+
end
|
21
40
|
|
22
|
-
if
|
41
|
+
# The authorization server responds with HTTP status code 200 if the client
|
42
|
+
# submitted an invalid token or the token has been revoked successfully.
|
43
|
+
if token.blank?
|
44
|
+
render json: {}, status: 200
|
45
|
+
# The authorization server validates [...] and whether the token
|
46
|
+
# was issued to the client making the revocation request. If this
|
47
|
+
# validation fails, the request is refused and the client is informed
|
48
|
+
# of the error by the authorization server as described below.
|
49
|
+
elsif authorized?
|
23
50
|
revoke_token
|
24
51
|
render json: {}, status: 200
|
25
52
|
else
|
@@ -42,8 +69,15 @@ module Doorkeeper
|
|
42
69
|
private
|
43
70
|
|
44
71
|
# OAuth 2.0 Section 2.1 defines two client types, "public" & "confidential".
|
45
|
-
#
|
46
|
-
#
|
72
|
+
#
|
73
|
+
# RFC7009
|
74
|
+
# Section 5. Security Considerations
|
75
|
+
# A malicious client may attempt to guess valid tokens on this endpoint
|
76
|
+
# by making revocation requests against potential token strings.
|
77
|
+
# According to this specification, a client's request must contain a
|
78
|
+
# valid client_id, in the case of a public client, or valid client
|
79
|
+
# credentials, in the case of a confidential client. The token being
|
80
|
+
# revoked must also belong to the requesting client.
|
47
81
|
#
|
48
82
|
# Once a confidential client is authenticated, it must be authorized to
|
49
83
|
# revoke the provided access or refresh token. This ensures one client
|
@@ -58,15 +92,13 @@ module Doorkeeper
|
|
58
92
|
# https://tools.ietf.org/html/rfc6749#section-2.1
|
59
93
|
# https://tools.ietf.org/html/rfc7009
|
60
94
|
def authorized?
|
61
|
-
|
62
|
-
|
63
|
-
# Client is confidential, therefore client authentication & authorization
|
64
|
-
# is required
|
95
|
+
# Token belongs to specific client, so we need to check if
|
96
|
+
# authenticated client could access it.
|
65
97
|
if token.application_id? && token.application.confidential?
|
66
98
|
# We authorize client by checking token's application
|
67
99
|
server.client && server.client.application == token.application
|
68
100
|
else
|
69
|
-
#
|
101
|
+
# Token was issued without client, authorization unnecessary
|
70
102
|
true
|
71
103
|
end
|
72
104
|
end
|
@@ -78,9 +110,12 @@ module Doorkeeper
|
|
78
110
|
token.revoke if token&.accessible?
|
79
111
|
end
|
80
112
|
|
113
|
+
# Doorkeeper does not use the token_type_hint logic described in the
|
114
|
+
# RFC 7009 due to the refresh token implementation that is a field in
|
115
|
+
# the access token model.
|
81
116
|
def token
|
82
|
-
@token ||=
|
83
|
-
|
117
|
+
@token ||= Doorkeeper.config.access_token_model.by_token(params["token"]) ||
|
118
|
+
Doorkeeper.config.access_token_model.by_refresh_token(params["token"])
|
84
119
|
end
|
85
120
|
|
86
121
|
def strategy
|
@@ -91,17 +126,22 @@ module Doorkeeper
|
|
91
126
|
@authorize_response ||= begin
|
92
127
|
before_successful_authorization
|
93
128
|
auth = strategy.authorize
|
94
|
-
|
129
|
+
context = build_context(auth: auth)
|
130
|
+
after_successful_authorization(context) unless auth.is_a?(Doorkeeper::OAuth::ErrorResponse)
|
95
131
|
auth
|
96
132
|
end
|
97
133
|
end
|
98
134
|
|
99
|
-
def
|
100
|
-
Doorkeeper.
|
135
|
+
def build_context(**attributes)
|
136
|
+
Doorkeeper::OAuth::Hooks::Context.new(**attributes)
|
137
|
+
end
|
138
|
+
|
139
|
+
def before_successful_authorization(context = nil)
|
140
|
+
Doorkeeper.config.before_successful_authorization.call(self, context)
|
101
141
|
end
|
102
142
|
|
103
|
-
def
|
104
|
-
Doorkeeper.
|
143
|
+
def after_successful_authorization(context)
|
144
|
+
Doorkeeper.config.after_successful_authorization.call(self, context)
|
105
145
|
end
|
106
146
|
|
107
147
|
def revocation_error_response
|