doorkeeper 6.0.0.beta2 → 6.0.0.rc2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -2
- data/README.md +29 -0
- data/app/controllers/doorkeeper/authorizations_controller.rb +66 -3
- data/app/controllers/doorkeeper/authorized_applications_controller.rb +23 -0
- data/app/controllers/doorkeeper/token_info_controller.rb +13 -1
- data/config/locales/en.yml +1 -0
- data/lib/doorkeeper/config/validations.rb +91 -0
- data/lib/doorkeeper/config.rb +18 -2
- data/lib/doorkeeper/errors.rb +14 -0
- data/lib/doorkeeper/grape/helpers.rb +11 -1
- data/lib/doorkeeper/helpers/controller.rb +12 -0
- data/lib/doorkeeper/http_fetcher.rb +79 -19
- data/lib/doorkeeper/models/access_token_mixin.rb +120 -2
- data/lib/doorkeeper/models/concerns/secret_storable.rb +72 -6
- data/lib/doorkeeper/oauth/authorization/token.rb +87 -8
- data/lib/doorkeeper/oauth/client_authentication/client_secret_basic.rb +13 -0
- data/lib/doorkeeper/oauth/client_authentication/private_key_jwt.rb +27 -20
- data/lib/doorkeeper/oauth/client_credentials/creator.rb +17 -3
- data/lib/doorkeeper/oauth/helpers/uri_checker.rb +14 -0
- data/lib/doorkeeper/oauth/metadata_response.rb +4 -3
- data/lib/doorkeeper/oauth/pre_authorization.rb +50 -0
- data/lib/doorkeeper/oauth/refresh_token_request.rb +81 -24
- data/lib/doorkeeper/oauth/resource_indicator_validator.rb +10 -0
- data/lib/doorkeeper/oauth/token.rb +94 -2
- data/lib/doorkeeper/oauth/token_introspection.rb +14 -1
- data/lib/doorkeeper/orm/active_record/mixins/access_grant.rb +1 -0
- data/lib/doorkeeper/orm/active_record/mixins/access_token.rb +1 -0
- data/lib/doorkeeper/orm/active_record/mixins/application.rb +1 -0
- data/lib/doorkeeper/orm/active_record/mixins/secret_storable.rb +113 -0
- data/lib/doorkeeper/orm/active_record/redirect_uri_validator.rb +5 -1
- data/lib/doorkeeper/orm/active_record.rb +1 -0
- data/lib/doorkeeper/rails/helpers.rb +25 -2
- data/lib/doorkeeper/request.rb +19 -7
- data/lib/doorkeeper/version.rb +1 -1
- data/lib/doorkeeper.rb +11 -0
- data/lib/generators/doorkeeper/refresh_token_scopes_generator.rb +43 -0
- data/lib/generators/doorkeeper/templates/add_refresh_token_scopes_to_access_tokens.rb.erb +10 -0
- data/lib/generators/doorkeeper/templates/initializer.rb +94 -15
- data/lib/generators/doorkeeper/templates/migration.rb.erb +9 -0
- metadata +12 -12
|
@@ -13,6 +13,8 @@ module Doorkeeper
|
|
|
13
13
|
|
|
14
14
|
def doorkeeper_forbidden_render_options(**); end
|
|
15
15
|
|
|
16
|
+
def doorkeeper_bad_request_render_options(**); end
|
|
17
|
+
|
|
16
18
|
def valid_doorkeeper_token?
|
|
17
19
|
doorkeeper_token&.acceptable?(@_doorkeeper_scopes)
|
|
18
20
|
end
|
|
@@ -42,15 +44,28 @@ module Doorkeeper
|
|
|
42
44
|
end
|
|
43
45
|
|
|
44
46
|
def doorkeeper_error
|
|
45
|
-
if
|
|
47
|
+
if @_doorkeeper_multiple_token_methods_error
|
|
48
|
+
OAuth::InvalidRequestResponse.new(
|
|
49
|
+
reason: @_doorkeeper_multiple_token_methods_error.reason,
|
|
50
|
+
)
|
|
51
|
+
elsif doorkeeper_invalid_token_response?
|
|
46
52
|
OAuth::InvalidTokenResponse.from_access_token(doorkeeper_token)
|
|
47
53
|
else
|
|
48
54
|
OAuth::ForbiddenTokenResponse.from_scopes(@_doorkeeper_scopes)
|
|
49
55
|
end
|
|
50
56
|
end
|
|
51
57
|
|
|
58
|
+
# Keyed on the response doorkeeper_error chose rather than on the state
|
|
59
|
+
# that chose it, so a response this method does not know about cannot be
|
|
60
|
+
# rendered through a hook meant for a different one: a request refused
|
|
61
|
+
# for transmitting the token by more than one method leaves
|
|
62
|
+
# doorkeeper_token nil, and answering it through the hook a host wrote
|
|
63
|
+
# for its 401s would give an "unauthorized" body a 400 status.
|
|
52
64
|
def doorkeeper_render_options(error)
|
|
53
|
-
|
|
65
|
+
case error.status
|
|
66
|
+
when :bad_request
|
|
67
|
+
doorkeeper_bad_request_render_options(error: error)
|
|
68
|
+
when :unauthorized
|
|
54
69
|
doorkeeper_unauthorized_render_options(error: error)
|
|
55
70
|
else
|
|
56
71
|
doorkeeper_forbidden_render_options(error: error)
|
|
@@ -69,6 +84,11 @@ module Doorkeeper
|
|
|
69
84
|
!doorkeeper_token || !doorkeeper_token.accessible?
|
|
70
85
|
end
|
|
71
86
|
|
|
87
|
+
# Answers nil (not a raise) when the request transmits an access token
|
|
88
|
+
# by more than one method, so host code that consults doorkeeper_token
|
|
89
|
+
# directly keeps its token-or-nil contract; doorkeeper_authorize! then
|
|
90
|
+
# renders the invalid_request (400) response RFC 6750 §3.1 prescribes
|
|
91
|
+
# instead of invalid_token, via doorkeeper_error above.
|
|
72
92
|
def doorkeeper_token
|
|
73
93
|
return @doorkeeper_token if defined?(@doorkeeper_token)
|
|
74
94
|
|
|
@@ -76,6 +96,9 @@ module Doorkeeper
|
|
|
76
96
|
request,
|
|
77
97
|
*Doorkeeper.config.access_token_methods,
|
|
78
98
|
)
|
|
99
|
+
rescue Errors::MultipleAccessTokenMethods => e
|
|
100
|
+
@_doorkeeper_multiple_token_methods_error = e
|
|
101
|
+
@doorkeeper_token = nil
|
|
79
102
|
end
|
|
80
103
|
end
|
|
81
104
|
end
|
data/lib/doorkeeper/request.rb
CHANGED
|
@@ -25,18 +25,30 @@ module Doorkeeper
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
# Resolves the strategy that answers the given response_type at the
|
|
29
|
+
# authorization endpoint.
|
|
30
|
+
#
|
|
31
|
+
# A response_type no registered authorization flow handles is refused
|
|
32
|
+
# rather than turned into a class name: `constantize` would otherwise
|
|
33
|
+
# resolve any constant under Doorkeeper::Request, token endpoint
|
|
34
|
+
# strategies (`password`, `client_credentials`, `refresh_token`,
|
|
35
|
+
# `authorization_code`) included, none of which can answer an
|
|
36
|
+
# authorization request.
|
|
28
37
|
def authorization_strategy(response_type)
|
|
38
|
+
response_type = response_type.to_s
|
|
39
|
+
|
|
29
40
|
grant_flow = authorization_flows.detect do |flow|
|
|
30
41
|
flow.matches_response_type?(response_type)
|
|
31
42
|
end
|
|
32
43
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
raise Errors::InvalidTokenStrategy unless grant_flow
|
|
45
|
+
|
|
46
|
+
# [NOTE]: this will be removed in a newer versions of Doorkeeper.
|
|
47
|
+
# For retro-compatibility only: flows declared through the deprecated
|
|
48
|
+
# Config#calculate_authorization_response_types hook are built as
|
|
49
|
+
# GrantFlow::FallbackFlow and carry no strategy, so the class is looked
|
|
50
|
+
# up by name — but only for a response type the server does declare.
|
|
51
|
+
grant_flow.response_type_strategy || build_fallback_strategy_class(response_type)
|
|
40
52
|
end
|
|
41
53
|
|
|
42
54
|
def token_strategy(grant_type)
|
data/lib/doorkeeper/version.rb
CHANGED
data/lib/doorkeeper.rb
CHANGED
|
@@ -206,8 +206,19 @@ module Doorkeeper
|
|
|
206
206
|
@orm_adapter.initialize_application_owner!
|
|
207
207
|
end
|
|
208
208
|
|
|
209
|
+
# Answers the access token authorizing the request, or nil when there is
|
|
210
|
+
# none. A request that transmits a token by more than one method (RFC 6750
|
|
211
|
+
# §2) has no single authorizing token, so it answers nil here rather than
|
|
212
|
+
# propagating Errors::MultipleAccessTokenMethods: this is the entry point
|
|
213
|
+
# host applications call, and its token-or-nil contract is what they build
|
|
214
|
+
# on. Callers that need to tell a refused request apart from one that
|
|
215
|
+
# carried no token — to describe it as the multi-method refusal it is —
|
|
216
|
+
# call OAuth::Token.authenticate and handle the error, as the Rails and
|
|
217
|
+
# Grape helpers do.
|
|
209
218
|
def authenticate(request, methods = Doorkeeper.config.access_token_methods)
|
|
210
219
|
OAuth::Token.authenticate(request, *methods)
|
|
220
|
+
rescue Errors::MultipleAccessTokenMethods
|
|
221
|
+
nil
|
|
211
222
|
end
|
|
212
223
|
|
|
213
224
|
def gem_version
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails/generators"
|
|
4
|
+
require "rails/generators/active_record"
|
|
5
|
+
|
|
6
|
+
module Doorkeeper
|
|
7
|
+
# Generates migration to add the refresh token scopes column to the
|
|
8
|
+
# database for Doorkeeper tables, so that a refresh token keeps the scope
|
|
9
|
+
# originally granted by the resource owner (RFC 6749 §6) when the access
|
|
10
|
+
# tokens issued with it are narrowed.
|
|
11
|
+
#
|
|
12
|
+
class RefreshTokenScopesGenerator < ::Rails::Generators::Base
|
|
13
|
+
include ::Rails::Generators::Migration
|
|
14
|
+
source_root File.expand_path("templates", __dir__)
|
|
15
|
+
desc "Keep the granted scope on refresh tokens (RFC 6749 §6)"
|
|
16
|
+
|
|
17
|
+
def self.next_migration_number(path)
|
|
18
|
+
ActiveRecord::Generators::Base.next_migration_number(path)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def refresh_token_scopes
|
|
22
|
+
return unless no_refresh_token_scopes_column?
|
|
23
|
+
|
|
24
|
+
migration_template(
|
|
25
|
+
"add_refresh_token_scopes_to_access_tokens.rb.erb",
|
|
26
|
+
"db/migrate/add_refresh_token_scopes_to_access_tokens.rb",
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def migration_version
|
|
33
|
+
"[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def no_refresh_token_scopes_column?
|
|
37
|
+
!ActiveRecord::Base.connection.column_exists?(
|
|
38
|
+
:oauth_access_tokens,
|
|
39
|
+
:refresh_token_scopes,
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class AddRefreshTokenScopesToAccessTokens < ActiveRecord::Migration<%= migration_version %>
|
|
4
|
+
def change
|
|
5
|
+
# Existing rows are left NULL: their refresh tokens keep behaving as
|
|
6
|
+
# before (validated against the access token's own scope) until they
|
|
7
|
+
# are rotated, at which point the new row records the granted scope.
|
|
8
|
+
add_column :oauth_access_tokens, :refresh_token_scopes, :string
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -119,9 +119,13 @@ Doorkeeper.configure do
|
|
|
119
119
|
# non-expiring access token (which is not recommended) then you need to return
|
|
120
120
|
# Float::INFINITY from this block.
|
|
121
121
|
#
|
|
122
|
+
# The block is also called for the refresh_token grant (`context.grant_type` is
|
|
123
|
+
# Doorkeeper::OAuth::REFRESH_TOKEN). Returning `nil` there keeps the TTL of the token
|
|
124
|
+
# being refreshed rather than falling back to +access_token_expires_in+.
|
|
125
|
+
#
|
|
122
126
|
# `context` has the following properties available:
|
|
123
127
|
#
|
|
124
|
-
# * `client` - the
|
|
128
|
+
# * `client` - the client application record (Doorkeeper::Application, or nil when client authentication was skipped)
|
|
125
129
|
# * `grant_type` - the grant type of the request (see Doorkeeper::OAuth)
|
|
126
130
|
# * `scopes` - the requested scopes (see Doorkeeper::OAuth::Scopes)
|
|
127
131
|
# * `resource_owner` - authorized resource owner instance (if present)
|
|
@@ -130,6 +134,20 @@ Doorkeeper.configure do
|
|
|
130
134
|
# context.client.additional_settings.implicit_oauth_expiration
|
|
131
135
|
# end
|
|
132
136
|
|
|
137
|
+
# Cap the lifetime of access tokens issued to public (non-confidential) clients,
|
|
138
|
+
# for every grant including refresh_token, whatever +access_token_expires_in+ or
|
|
139
|
+
# +custom_access_token_expires_in+ would have given them (a never-expiring token
|
|
140
|
+
# is capped too). OAuth 2.1 (Section 2.4) requires an authorization server to limit
|
|
141
|
+
# the exposure of tokens issued to unauthenticated clients. A request without a
|
|
142
|
+
# client (e.g. with +skip_client_authentication_for_password_grant+) is treated as a
|
|
143
|
+
# public client. Confidential clients are not affected. Disabled (nil) by default.
|
|
144
|
+
#
|
|
145
|
+
# With +reuse_access_token+ enabled, an existing token that would outlive the cap
|
|
146
|
+
# (issued before the cap was configured, or while the client was confidential) is
|
|
147
|
+
# not reused for a public client; a new, capped token is issued instead.
|
|
148
|
+
#
|
|
149
|
+
# public_client_access_token_expires_in 1.hour
|
|
150
|
+
|
|
133
151
|
# Use a custom class for generating the access token.
|
|
134
152
|
# See https://doorkeeper.gitbook.io/guides/configuration/other-configurations#custom-access-token-generator
|
|
135
153
|
#
|
|
@@ -202,12 +220,26 @@ Doorkeeper.configure do
|
|
|
202
220
|
#
|
|
203
221
|
# force_pkce
|
|
204
222
|
|
|
223
|
+
# Validate the authorization request's client_id and redirect_uri before
|
|
224
|
+
# authenticating the resource owner, so users are not sent through login for
|
|
225
|
+
# a request that can only fail (RFC 6749 Section 4.1.2.1 asks for the
|
|
226
|
+
# resource owner to be informed of an invalid client_id, Section 3.1.2.4 of
|
|
227
|
+
# an invalid redirect URI). Disabled by default: enabling it changes when
|
|
228
|
+
# your `resource_owner_authenticator` block runs, and lets an unauthenticated
|
|
229
|
+
# party learn whether a client_id is registered (client identifiers are not
|
|
230
|
+
# confidential per RFC 6749 Section 2.2). To refuse clients on your own terms
|
|
231
|
+
# as well, override Doorkeeper::AuthorizationsController#validate_client.
|
|
232
|
+
#
|
|
233
|
+
# validate_client_before_resource_owner_authentication
|
|
234
|
+
|
|
205
235
|
# Hash access and refresh tokens before persisting them.
|
|
206
236
|
# This will disable the possibility to use +reuse_access_token+
|
|
207
237
|
# since plain values can no longer be retrieved.
|
|
208
238
|
#
|
|
209
239
|
# Note: If you are already a user of doorkeeper and have existing tokens
|
|
210
240
|
# in your installation, they will be invalid without adding 'fallback: :plain'.
|
|
241
|
+
# Read the note on the fallback option below before you do: it is a setting
|
|
242
|
+
# for the migration period, not a permanent one.
|
|
211
243
|
#
|
|
212
244
|
# hash_token_secrets
|
|
213
245
|
# By default, token secrets will be hashed using the
|
|
@@ -234,23 +266,37 @@ Doorkeeper.configure do
|
|
|
234
266
|
# hash_application_secrets using: '::Doorkeeper::SecretStoring::BCrypt'
|
|
235
267
|
|
|
236
268
|
# When the above option is enabled, and a hashed token or secret is not found,
|
|
237
|
-
# you can allow to fall back to another strategy
|
|
238
|
-
#
|
|
239
|
-
# the fallback to plain tokens
|
|
240
|
-
#
|
|
241
|
-
# This will ensure that old access tokens and secrets
|
|
242
|
-
# will remain valid even if the hashing above is enabled.
|
|
243
|
-
#
|
|
244
|
-
# This can be done by adding 'fallback: plain', e.g. :
|
|
269
|
+
# you can allow to fall back to another strategy, so that values written
|
|
270
|
+
# before hashing was enabled remain valid. For users upgrading doorkeeper and
|
|
271
|
+
# wishing to enable hashing, that is the fallback to plain tokens, added with
|
|
272
|
+
# 'fallback: :plain', e.g. :
|
|
245
273
|
#
|
|
246
274
|
# hash_application_secrets using: '::Doorkeeper::SecretStoring::BCrypt', fallback: :plain
|
|
275
|
+
#
|
|
276
|
+
# [IMPORTANT] The fallback is meant for the migration period only, and should
|
|
277
|
+
# be removed once every row has been migrated to the hashed format. A value
|
|
278
|
+
# found through the fallback is rewritten in the new format as it is used, so
|
|
279
|
+
# rows migrate themselves as their tokens and secrets are presented; rows that
|
|
280
|
+
# are never presented again keep their old format until you migrate or clean
|
|
281
|
+
# them up yourself. Doorkeeper warns at boot for as long as a fallback is
|
|
282
|
+
# configured.
|
|
283
|
+
#
|
|
284
|
+
# While 'fallback: :plain' is configured, a stored value is itself a valid
|
|
285
|
+
# credential: the fallback looks the column up by the value exactly as it was
|
|
286
|
+
# given, so whatever the column holds authenticates. What the hashing above is
|
|
287
|
+
# meant to protect you from - a database dump, a read-only SQL injection, a
|
|
288
|
+
# query written to a log - still yields usable tokens and secrets. Protect the
|
|
289
|
+
# contents of those columns as carefully as plaintext credentials for as long
|
|
290
|
+
# as it is configured, and remove it as soon as the migration is done. A
|
|
291
|
+
# fallback to another hashing strategy still transforms what it stores, so
|
|
292
|
+
# only the reminder above applies to it.
|
|
247
293
|
|
|
248
294
|
# Issue access tokens with refresh token (disabled by default), you may also
|
|
249
295
|
# pass a block which accepts `context` to customize when to give a refresh
|
|
250
296
|
# token or not. Similar to +custom_access_token_expires_in+, `context` has
|
|
251
297
|
# the following properties:
|
|
252
298
|
#
|
|
253
|
-
# `client` - the
|
|
299
|
+
# `client` - the client application record (Doorkeeper::Application, or nil when client authentication was skipped)
|
|
254
300
|
# `grant_type` - the grant type of the request (see Doorkeeper::OAuth)
|
|
255
301
|
# `scopes` - the requested scopes (see Doorkeeper::OAuth::Scopes)
|
|
256
302
|
#
|
|
@@ -321,9 +367,11 @@ Doorkeeper.configure do
|
|
|
321
367
|
# private_key_jwt_jwks_cache Doorkeeper::DocumentCache.new(ttl: 300)
|
|
322
368
|
#
|
|
323
369
|
# The accepted audiences are built from your `issuer` or from Rails'
|
|
324
|
-
# `default_url_options
|
|
325
|
-
#
|
|
326
|
-
#
|
|
370
|
+
# `default_url_options`, never from the request's Host header - the audience
|
|
371
|
+
# is what tells your server apart from another one, so it cannot come from a
|
|
372
|
+
# value the caller controls. Set at least one of them: with neither
|
|
373
|
+
# configured no audience is acceptable and every assertion is refused
|
|
374
|
+
# (Doorkeeper says so in the log at boot).
|
|
327
375
|
#
|
|
328
376
|
# A client's `jwks_uri` is fetched with a hardened HTTP client (HTTPS
|
|
329
377
|
# only, no redirects, hosts resolving to RFC 6890 special-use addresses
|
|
@@ -339,6 +387,23 @@ Doorkeeper.configure do
|
|
|
339
387
|
# Check out https://github.com/doorkeeper-gem/doorkeeper/wiki/Changing-how-clients-are-authenticated
|
|
340
388
|
# for more information on customization
|
|
341
389
|
#
|
|
390
|
+
# RFC 6750 §2 defines three transmission methods and forbids a client from
|
|
391
|
+
# using more than one of them per request, so a request presenting a token
|
|
392
|
+
# through two of the built-in methods is refused with `invalid_request`
|
|
393
|
+
# (400). What §2 forbids is the second method, not a disagreement between
|
|
394
|
+
# the two, so repeating the same token across methods is refused as well.
|
|
395
|
+
# The form-encoded body (§2.2) and the URI query (§2.3) count as two methods
|
|
396
|
+
# even though Rails and Rack merge them into a single `params` hash, so
|
|
397
|
+
# `access_token` carried by both is refused too.
|
|
398
|
+
#
|
|
399
|
+
# A custom callable extractor sits outside that check and keeps the
|
|
400
|
+
# historical first-wins selection — the same boundary client authentication
|
|
401
|
+
# draws around the legacy `client_credentials` callable extractors. If you
|
|
402
|
+
# configure one, a request presenting one token through it and a different
|
|
403
|
+
# token through a built-in method is served under whichever comes first in
|
|
404
|
+
# this list, and the other is discarded, so make sure the layers in front of
|
|
405
|
+
# Doorkeeper agree with this list about which one authorizes the request.
|
|
406
|
+
#
|
|
342
407
|
# access_token_methods :from_bearer_authorization, :from_access_token_param, :from_bearer_param
|
|
343
408
|
|
|
344
409
|
# Forces the usage of the HTTPS protocol in non-native redirect uris (enabled
|
|
@@ -356,10 +421,13 @@ Doorkeeper.configure do
|
|
|
356
421
|
# Specify what redirect URI's you want to block during Application creation.
|
|
357
422
|
# Any redirect URI is allowed by default.
|
|
358
423
|
#
|
|
359
|
-
#
|
|
424
|
+
# Redirect URIs with a script scheme (`javascript`, `vbscript`, `data`) are
|
|
425
|
+
# always rejected, regardless of this option.
|
|
426
|
+
#
|
|
427
|
+
# You can use this option in order to forbid URI's of a particular host
|
|
360
428
|
# for example.
|
|
361
429
|
#
|
|
362
|
-
# forbid_redirect_uri { |uri| uri.
|
|
430
|
+
# forbid_redirect_uri { |uri| uri.host == 'example.com' }
|
|
363
431
|
|
|
364
432
|
# Allows to set blank redirect URIs for Applications in case Doorkeeper configured
|
|
365
433
|
# to use URI-less OAuth grant flows like Client Credentials or Resource Owner
|
|
@@ -391,6 +459,17 @@ Doorkeeper.configure do
|
|
|
391
459
|
# Doorkeeper::Errors::TokenForbidden, Doorkeeper::Errors::TokenExpired,
|
|
392
460
|
# Doorkeeper::Errors::TokenRevoked, Doorkeeper::Errors::TokenUnknown
|
|
393
461
|
#
|
|
462
|
+
# One more can reach your rescue: a request that transmits an access token by
|
|
463
|
+
# more than one method (RFC 6750 §2 forbids it) is refused as invalid_request
|
|
464
|
+
# rather than invalid_token, and raises
|
|
465
|
+
#
|
|
466
|
+
# Doorkeeper::Errors::InvalidRequest
|
|
467
|
+
#
|
|
468
|
+
# That one is a sibling of Doorkeeper::Errors::InvalidToken, not a subclass,
|
|
469
|
+
# so an existing `rescue Doorkeeper::Errors::InvalidToken` does not cover it.
|
|
470
|
+
# Rescue it explicitly, or rescue their common parent
|
|
471
|
+
# Doorkeeper::Errors::BaseResponseError, to handle both.
|
|
472
|
+
#
|
|
394
473
|
# handle_auth_errors :raise
|
|
395
474
|
#
|
|
396
475
|
# If you want to redirect back to the client application in accordance with
|
|
@@ -85,6 +85,15 @@ class CreateDoorkeeperTables < ActiveRecord::Migration<%= migration_version %>
|
|
|
85
85
|
# Comment out this line if you want refresh tokens to be instantly
|
|
86
86
|
# revoked after use.
|
|
87
87
|
t.string :previous_refresh_token, null: false, default: ""
|
|
88
|
+
|
|
89
|
+
# A refresh token keeps the scope originally granted by the resource
|
|
90
|
+
# owner, so a client that narrowed an access token on one refresh can
|
|
91
|
+
# request the granted scope again on the next one.
|
|
92
|
+
# @see https://datatracker.ietf.org/doc/html/rfc6749#section-6
|
|
93
|
+
#
|
|
94
|
+
# Comment out this line if you want a narrowed refresh to permanently
|
|
95
|
+
# narrow the refresh token as well.
|
|
96
|
+
t.string :refresh_token_scopes
|
|
88
97
|
end
|
|
89
98
|
|
|
90
99
|
add_index :oauth_access_tokens, :token, unique: true
|
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: doorkeeper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.0.
|
|
4
|
+
version: 6.0.0.rc2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Felipe Elias Philipp
|
|
8
8
|
- Tute Costa
|
|
9
9
|
- Jon Moss
|
|
10
10
|
- Nikita Bulai
|
|
11
|
-
autorequire:
|
|
12
11
|
bindir: bin
|
|
13
12
|
cert_chain: []
|
|
14
|
-
date: 2026-
|
|
13
|
+
date: 2026-09-24 00:00:00.000000000 Z
|
|
15
14
|
dependencies:
|
|
16
15
|
- !ruby/object:Gem::Dependency
|
|
17
16
|
name: railties
|
|
@@ -56,19 +55,19 @@ dependencies:
|
|
|
56
55
|
- !ruby/object:Gem::Version
|
|
57
56
|
version: '0'
|
|
58
57
|
- !ruby/object:Gem::Dependency
|
|
59
|
-
name:
|
|
58
|
+
name: simplecov
|
|
60
59
|
requirement: !ruby/object:Gem::Requirement
|
|
61
60
|
requirements:
|
|
62
|
-
- - "
|
|
61
|
+
- - "~>"
|
|
63
62
|
- !ruby/object:Gem::Version
|
|
64
|
-
version: '
|
|
63
|
+
version: '1.1'
|
|
65
64
|
type: :development
|
|
66
65
|
prerelease: false
|
|
67
66
|
version_requirements: !ruby/object:Gem::Requirement
|
|
68
67
|
requirements:
|
|
69
|
-
- - "
|
|
68
|
+
- - "~>"
|
|
70
69
|
- !ruby/object:Gem::Version
|
|
71
|
-
version: '
|
|
70
|
+
version: '1.1'
|
|
72
71
|
- !ruby/object:Gem::Dependency
|
|
73
72
|
name: database_cleaner
|
|
74
73
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -317,6 +316,7 @@ files:
|
|
|
317
316
|
- lib/doorkeeper/orm/active_record/mixins/access_grant.rb
|
|
318
317
|
- lib/doorkeeper/orm/active_record/mixins/access_token.rb
|
|
319
318
|
- lib/doorkeeper/orm/active_record/mixins/application.rb
|
|
319
|
+
- lib/doorkeeper/orm/active_record/mixins/secret_storable.rb
|
|
320
320
|
- lib/doorkeeper/orm/active_record/redirect_uri_validator.rb
|
|
321
321
|
- lib/doorkeeper/orm/active_record/stale_records_cleaner.rb
|
|
322
322
|
- lib/doorkeeper/rails/helpers.rb
|
|
@@ -354,6 +354,7 @@ files:
|
|
|
354
354
|
- lib/generators/doorkeeper/migration_generator.rb
|
|
355
355
|
- lib/generators/doorkeeper/pkce_generator.rb
|
|
356
356
|
- lib/generators/doorkeeper/previous_refresh_token_generator.rb
|
|
357
|
+
- lib/generators/doorkeeper/refresh_token_scopes_generator.rb
|
|
357
358
|
- lib/generators/doorkeeper/remove_applications_secret_not_null_constraint_generator.rb
|
|
358
359
|
- lib/generators/doorkeeper/resource_indicators_generator.rb
|
|
359
360
|
- lib/generators/doorkeeper/templates/README
|
|
@@ -361,6 +362,7 @@ files:
|
|
|
361
362
|
- lib/generators/doorkeeper/templates/add_confidential_to_applications.rb.erb
|
|
362
363
|
- lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb.erb
|
|
363
364
|
- lib/generators/doorkeeper/templates/add_previous_refresh_token_to_access_tokens.rb.erb
|
|
365
|
+
- lib/generators/doorkeeper/templates/add_refresh_token_scopes_to_access_tokens.rb.erb
|
|
364
366
|
- lib/generators/doorkeeper/templates/enable_pkce_migration.rb.erb
|
|
365
367
|
- lib/generators/doorkeeper/templates/enable_polymorphic_resource_owner_migration.rb.erb
|
|
366
368
|
- lib/generators/doorkeeper/templates/enable_resource_indicators_migration.rb.erb
|
|
@@ -379,7 +381,6 @@ metadata:
|
|
|
379
381
|
bug_tracker_uri: https://github.com/doorkeeper-gem/doorkeeper/issues
|
|
380
382
|
documentation_uri: https://doorkeeper.gitbook.io/guides/
|
|
381
383
|
funding_uri: https://opencollective.com/doorkeeper-gem
|
|
382
|
-
post_install_message:
|
|
383
384
|
rdoc_options: []
|
|
384
385
|
require_paths:
|
|
385
386
|
- lib
|
|
@@ -387,15 +388,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
387
388
|
requirements:
|
|
388
389
|
- - ">="
|
|
389
390
|
- !ruby/object:Gem::Version
|
|
390
|
-
version: '2
|
|
391
|
+
version: '3.2'
|
|
391
392
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
392
393
|
requirements:
|
|
393
394
|
- - ">="
|
|
394
395
|
- !ruby/object:Gem::Version
|
|
395
396
|
version: '0'
|
|
396
397
|
requirements: []
|
|
397
|
-
rubygems_version: 3.
|
|
398
|
-
signing_key:
|
|
398
|
+
rubygems_version: 3.6.2
|
|
399
399
|
specification_version: 4
|
|
400
400
|
summary: OAuth 2 provider for Rails and Grape
|
|
401
401
|
test_files: []
|