doorkeeper 6.0.0.beta1 → 6.0.0.beta2

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -1
  3. data/README.md +203 -0
  4. data/app/controllers/doorkeeper/applications_controller.rb +38 -9
  5. data/app/controllers/doorkeeper/authorizations_controller.rb +17 -3
  6. data/app/controllers/doorkeeper/tokens_controller.rb +5 -1
  7. data/app/views/doorkeeper/authorizations/new.html.erb +18 -0
  8. data/config/locales/en.yml +2 -0
  9. data/lib/doorkeeper/client_authentication/legacy_callable.rb +6 -0
  10. data/lib/doorkeeper/client_authentication/method.rb +17 -0
  11. data/lib/doorkeeper/client_authentication/verified_credentials.rb +19 -0
  12. data/lib/doorkeeper/client_authentication.rb +9 -0
  13. data/lib/doorkeeper/config.rb +47 -0
  14. data/lib/doorkeeper/document_cache.rb +81 -0
  15. data/lib/doorkeeper/errors.rb +48 -0
  16. data/lib/doorkeeper/http_fetcher.rb +232 -0
  17. data/lib/doorkeeper/models/access_grant_mixin.rb +16 -0
  18. data/lib/doorkeeper/models/access_token_mixin.rb +42 -1
  19. data/lib/doorkeeper/oauth/authorization/code.rb +10 -0
  20. data/lib/doorkeeper/oauth/authorization/token.rb +13 -2
  21. data/lib/doorkeeper/oauth/authorization_code_request.rb +123 -2
  22. data/lib/doorkeeper/oauth/base_request.rb +1 -2
  23. data/lib/doorkeeper/oauth/client.rb +6 -0
  24. data/lib/doorkeeper/oauth/client_authentication/client_secret_basic.rb +4 -0
  25. data/lib/doorkeeper/oauth/client_authentication/client_secret_post.rb +4 -0
  26. data/lib/doorkeeper/oauth/client_authentication/none.rb +47 -8
  27. data/lib/doorkeeper/oauth/client_authentication/private_key_jwt/key_resolver.rb +104 -0
  28. data/lib/doorkeeper/oauth/client_authentication/private_key_jwt/replay_guard.rb +78 -0
  29. data/lib/doorkeeper/oauth/client_authentication/private_key_jwt.rb +247 -0
  30. data/lib/doorkeeper/oauth/client_credentials/creator.rb +25 -9
  31. data/lib/doorkeeper/oauth/client_credentials_request.rb +36 -5
  32. data/lib/doorkeeper/oauth/helpers/uri_checker.rb +35 -23
  33. data/lib/doorkeeper/oauth/metadata_response.rb +8 -0
  34. data/lib/doorkeeper/oauth/password_access_token_request.rb +27 -1
  35. data/lib/doorkeeper/oauth/pre_authorization.rb +51 -3
  36. data/lib/doorkeeper/oauth/refresh_token_request.rb +51 -1
  37. data/lib/doorkeeper/oauth/resource_indicator_validator.rb +70 -0
  38. data/lib/doorkeeper/oauth/scopes.rb +25 -0
  39. data/lib/doorkeeper/oauth/token_introspection.rb +6 -0
  40. data/lib/doorkeeper/version.rb +1 -1
  41. data/lib/doorkeeper.rb +4 -0
  42. data/lib/generators/doorkeeper/grant_reuse_revocation_generator.rb +43 -0
  43. data/lib/generators/doorkeeper/resource_indicators_generator.rb +33 -0
  44. data/lib/generators/doorkeeper/templates/add_access_token_to_access_grants.rb.erb +10 -0
  45. data/lib/generators/doorkeeper/templates/enable_resource_indicators_migration.rb.erb +8 -0
  46. data/lib/generators/doorkeeper/templates/initializer.rb +65 -0
  47. data/lib/generators/doorkeeper/templates/migration.rb.erb +13 -0
  48. metadata +45 -3
@@ -298,6 +298,40 @@ Doorkeeper.configure do
298
298
  # The legacy `client_credentials` option is deprecated; `:from_basic` and
299
299
  # `:from_params` are automatically mapped to `:client_secret_basic` and
300
300
  # `:client_secret_post`.
301
+ #
302
+ # A `private_key_jwt` method (RFC 7523 / OIDC Core §9) is also registered
303
+ # but not enabled by default — add it to the list above to accept it. It
304
+ # requires the `jwt` gem (>= 2.7) in your bundle, and verifies assertions
305
+ # against the client's published public keys: `jwks` / `jwks_uri`
306
+ # attributes you define on your Application model (Doorkeeper does not add
307
+ # these columns itself). Assertions must carry iss = sub =
308
+ # client_id, an aud of your `issuer` (or the token endpoint URL), a bounded
309
+ # exp (at most 1 hour ahead), a kid header, and a single-use jti.
310
+ #
311
+ # jti replay is tracked in process-local memory by default (bounded at
312
+ # 10 000 entries, each held at most 1 hour), so an assertion replayed to a
313
+ # different server process is not caught. To share the tracking across
314
+ # processes, supply your own store (e.g. backed by Redis):
315
+ #
316
+ # private_key_jwt_replay_guard MyRedisReplayGuard.new
317
+ #
318
+ # JWK Sets fetched from a `jwks_uri` are cached in process-local memory
319
+ # for 60 seconds; to change the TTL or share the cache across processes:
320
+ #
321
+ # private_key_jwt_jwks_cache Doorkeeper::DocumentCache.new(ttl: 300)
322
+ #
323
+ # The accepted audiences are built from your `issuer` or from Rails'
324
+ # `default_url_options`; set at least one of them, otherwise Doorkeeper has
325
+ # nothing but the request's Host header to identify itself with and the
326
+ # audience check cannot tell your server apart from another one.
327
+ #
328
+ # A client's `jwks_uri` is fetched with a hardened HTTP client (HTTPS
329
+ # only, no redirects, hosts resolving to RFC 6890 special-use addresses
330
+ # refused), so a jwks_uri on a private network or on localhost is refused
331
+ # even though you configured it yourself; inline `jwks` has no such
332
+ # restriction.
333
+ #
334
+ # client_authentication %i[client_secret_basic client_secret_post none private_key_jwt]
301
335
 
302
336
  # Change the way access token is authenticated from the request object.
303
337
  # By default it retrieves first from the `HTTP_AUTHORIZATION` header, then
@@ -333,6 +367,9 @@ Doorkeeper.configure do
333
367
  # types, but you **need** to manually drop `NOT NULL` constraint from `redirect_uri`
334
368
  # column for `oauth_applications` database table.
335
369
  #
370
+ # You almost certainly do not want to change this. There are very, very few cases
371
+ # where you want to change this configuration value.
372
+ #
336
373
  # You can completely disable this feature with:
337
374
  #
338
375
  # allow_blank_redirect_uri false
@@ -601,4 +638,32 @@ Doorkeeper.configure do
601
638
  # custom_metadata(
602
639
  # userinfo_endpoint: "https://auth.example.com/oauth/userinfo",
603
640
  # )
641
+
642
+ # Resource Indicators for OAuth 2.0 (RFC 8707)
643
+ #
644
+ # When configured with a callable, enables RFC 8707 support. The callable
645
+ # receives an array of resource indicator URIs and the OAuth client, and must
646
+ # return true if the resources are acceptable, or false to reject with
647
+ # `invalid_target`.
648
+ #
649
+ # Clients may then include one or more `resource` parameters in authorization
650
+ # and token requests to signal which protected resource(s) they intend to
651
+ # access. The authorization server will:
652
+ # - Validate resource URIs (must be absolute, no fragment)
653
+ # - Store resource indicators on grants and tokens
654
+ # - Enforce subset restrictions on token/refresh requests
655
+ # - Include `aud` in token introspection responses
656
+ #
657
+ # NOTE: RFC 8707 specifies repeated query parameters (?resource=…&resource=…)
658
+ # for multiple values, but Rack collapses repeated keys to the last value.
659
+ # Clients must use the Rails bracket syntax (resource[]=…&resource[]=…) to
660
+ # send multiple resource indicators. A single resource=… works as-is.
661
+ #
662
+ # To use this feature, first run `rails generate doorkeeper:resource_indicators`
663
+ # to add the required `resource` column to the access grants and tokens tables.
664
+ #
665
+ # resource_indicator_validator ->(resource_indicators, client) {
666
+ # allowed = %w[https://api.example.com/ https://calendar.example.com/]
667
+ # resource_indicators.all? { |r| allowed.include?(r) }
668
+ # }
604
669
  end
@@ -28,6 +28,19 @@ class CreateDoorkeeperTables < ActiveRecord::Migration<%= migration_version %>
28
28
  t.string :scopes, null: false, default: ''
29
29
  t.datetime :created_at, null: false
30
30
  t.datetime :revoked_at
31
+
32
+ # Authorization codes are single-use (RFC 6749 §4.1.2). Doorkeeper
33
+ # records the access token issued when the code is exchanged, so that
34
+ # a second exchange attempt revokes the previously issued tokens as
35
+ # recommended by RFC 6749 §10.5.
36
+ #
37
+ # Comment out this line if you don't want a reused authorization code
38
+ # to revoke the tokens already issued for it.
39
+ #
40
+ # Indexed: when a code is replayed, the revocation checks whether the
41
+ # issued token is still referenced by another grant, which filters
42
+ # this table by access_token_id.
43
+ t.references :access_token, index: true
31
44
  end
32
45
 
33
46
  add_index :oauth_access_grants, :token, unique: true
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0.beta1
4
+ version: 6.0.0.beta2
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:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 1980-01-02 00:00:00.000000000 Z
14
+ date: 2026-08-10 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: railties
@@ -124,6 +125,20 @@ dependencies:
124
125
  - - ">="
125
126
  - !ruby/object:Gem::Version
126
127
  version: '0'
128
+ - !ruby/object:Gem::Dependency
129
+ name: jwt
130
+ requirement: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '2.7'
135
+ type: :development
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '2.7'
127
142
  - !ruby/object:Gem::Dependency
128
143
  name: rake
129
144
  requirement: !ruby/object:Gem::Requirement
@@ -166,6 +181,20 @@ dependencies:
166
181
  - - ">="
167
182
  - !ruby/object:Gem::Version
168
183
  version: '0'
184
+ - !ruby/object:Gem::Dependency
185
+ name: webmock
186
+ requirement: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
191
+ type: :development
192
+ prerelease: false
193
+ version_requirements: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
169
198
  description: Doorkeeper is an OAuth 2 provider for Rails and Grape.
170
199
  email:
171
200
  - bulaj.nikita@gmail.com
@@ -209,10 +238,12 @@ files:
209
238
  - lib/doorkeeper/client_authentication/legacy_callable.rb
210
239
  - lib/doorkeeper/client_authentication/method.rb
211
240
  - lib/doorkeeper/client_authentication/registry.rb
241
+ - lib/doorkeeper/client_authentication/verified_credentials.rb
212
242
  - lib/doorkeeper/config.rb
213
243
  - lib/doorkeeper/config/abstract_builder.rb
214
244
  - lib/doorkeeper/config/option.rb
215
245
  - lib/doorkeeper/config/validations.rb
246
+ - lib/doorkeeper/document_cache.rb
216
247
  - lib/doorkeeper/engine.rb
217
248
  - lib/doorkeeper/errors.rb
218
249
  - lib/doorkeeper/grant_flow.rb
@@ -222,6 +253,7 @@ files:
222
253
  - lib/doorkeeper/grape/authorization_decorator.rb
223
254
  - lib/doorkeeper/grape/helpers.rb
224
255
  - lib/doorkeeper/helpers/controller.rb
256
+ - lib/doorkeeper/http_fetcher.rb
225
257
  - lib/doorkeeper/models/access_grant_mixin.rb
226
258
  - lib/doorkeeper/models/access_token_mixin.rb
227
259
  - lib/doorkeeper/models/application_mixin.rb
@@ -249,6 +281,9 @@ files:
249
281
  - lib/doorkeeper/oauth/client_authentication/client_secret_basic.rb
250
282
  - lib/doorkeeper/oauth/client_authentication/client_secret_post.rb
251
283
  - lib/doorkeeper/oauth/client_authentication/none.rb
284
+ - lib/doorkeeper/oauth/client_authentication/private_key_jwt.rb
285
+ - lib/doorkeeper/oauth/client_authentication/private_key_jwt/key_resolver.rb
286
+ - lib/doorkeeper/oauth/client_authentication/private_key_jwt/replay_guard.rb
252
287
  - lib/doorkeeper/oauth/client_credentials/creator.rb
253
288
  - lib/doorkeeper/oauth/client_credentials/issuer.rb
254
289
  - lib/doorkeeper/oauth/client_credentials/validator.rb
@@ -269,6 +304,7 @@ files:
269
304
  - lib/doorkeeper/oauth/password_access_token_request.rb
270
305
  - lib/doorkeeper/oauth/pre_authorization.rb
271
306
  - lib/doorkeeper/oauth/refresh_token_request.rb
307
+ - lib/doorkeeper/oauth/resource_indicator_validator.rb
272
308
  - lib/doorkeeper/oauth/scopes.rb
273
309
  - lib/doorkeeper/oauth/token.rb
274
310
  - lib/doorkeeper/oauth/token_introspection.rb
@@ -313,17 +349,21 @@ files:
313
349
  - lib/generators/doorkeeper/application_owner_generator.rb
314
350
  - lib/generators/doorkeeper/confidential_applications_generator.rb
315
351
  - lib/generators/doorkeeper/enable_polymorphic_resource_owner_generator.rb
352
+ - lib/generators/doorkeeper/grant_reuse_revocation_generator.rb
316
353
  - lib/generators/doorkeeper/install_generator.rb
317
354
  - lib/generators/doorkeeper/migration_generator.rb
318
355
  - lib/generators/doorkeeper/pkce_generator.rb
319
356
  - lib/generators/doorkeeper/previous_refresh_token_generator.rb
320
357
  - lib/generators/doorkeeper/remove_applications_secret_not_null_constraint_generator.rb
358
+ - lib/generators/doorkeeper/resource_indicators_generator.rb
321
359
  - lib/generators/doorkeeper/templates/README
360
+ - lib/generators/doorkeeper/templates/add_access_token_to_access_grants.rb.erb
322
361
  - lib/generators/doorkeeper/templates/add_confidential_to_applications.rb.erb
323
362
  - lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb.erb
324
363
  - lib/generators/doorkeeper/templates/add_previous_refresh_token_to_access_tokens.rb.erb
325
364
  - lib/generators/doorkeeper/templates/enable_pkce_migration.rb.erb
326
365
  - lib/generators/doorkeeper/templates/enable_polymorphic_resource_owner_migration.rb.erb
366
+ - lib/generators/doorkeeper/templates/enable_resource_indicators_migration.rb.erb
327
367
  - lib/generators/doorkeeper/templates/initializer.rb
328
368
  - lib/generators/doorkeeper/templates/migration.rb.erb
329
369
  - lib/generators/doorkeeper/templates/remove_applications_secret_not_null_constraint.rb.erb
@@ -339,6 +379,7 @@ metadata:
339
379
  bug_tracker_uri: https://github.com/doorkeeper-gem/doorkeeper/issues
340
380
  documentation_uri: https://doorkeeper.gitbook.io/guides/
341
381
  funding_uri: https://opencollective.com/doorkeeper-gem
382
+ post_install_message:
342
383
  rdoc_options: []
343
384
  require_paths:
344
385
  - lib
@@ -353,7 +394,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
353
394
  - !ruby/object:Gem::Version
354
395
  version: '0'
355
396
  requirements: []
356
- rubygems_version: 4.0.11
397
+ rubygems_version: 3.5.16
398
+ signing_key:
357
399
  specification_version: 4
358
400
  summary: OAuth 2 provider for Rails and Grape
359
401
  test_files: []