doorkeeper 5.2.3 → 5.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9d518348b70a1f9aed5f17d689151c1c5129c8508b25f9965887e101e9c1fd3
4
- data.tar.gz: d41ca23bd09b61ede59a73cc8e23ed3355d9ff4045019c15a65180836b5f597a
3
+ metadata.gz: adf3b17f0ba11cc257d433fe4fa18f1cf651a276403987e2d28d169736cdbf98
4
+ data.tar.gz: 44c0a5be81b9c1172e8d1c301c0f6924adc11a8d1b9e0f51b878754eade99009
5
5
  SHA512:
6
- metadata.gz: 812f872a66a89ac7a3a33efd529a04ff78af4bcddce2c0024f979994bd3855bc74f24c3e01dcdfbce31f90e8bb65efefec121abbd94469706b89fc00b0c43c2b
7
- data.tar.gz: f447e906568a6ba487772fd5555c861c51c3eaa97ee15bb1250aa51db71f5fece1e0cc652de1e6d0c385a47bd61d96cff984b9e493dc23b925e620fa6a293d85
6
+ metadata.gz: e48bb0dade513bd2f8da4442167fa3681a8d1845f3cf7cfa0506fe043bc3495ae3b0f8737599c5965d6bf53e8f79280063e1b994387904cf9e3021915ca9e403
7
+ data.tar.gz: 53c49b7bd09a5b4026058a7dccb4dc18aad52b4104f0b2abef1bf1c6f44bb2fff55308653ba14ae4a628c1be4d20dd833e4b7094883f8f3fa648e47d8950fa76
data/CHANGELOG.md CHANGED
@@ -5,9 +5,9 @@ upgrade guides.
5
5
 
6
6
  User-visible changes worth mentioning.
7
7
 
8
- ## master
8
+ ## 5.2.4
9
9
 
10
- - [#PR ID] Your PR short description.
10
+ - [#1360] Increase `matching_token_for` batch lookup size to 10 000 and make it configurable.
11
11
 
12
12
  ## 5.2.3
13
13
 
@@ -49,6 +49,11 @@ User-visible changes worth mentioning.
49
49
 
50
50
  - [#1270] Find matching tokens in batches for `reuse_access_token` option (fix #1193).
51
51
  - [#1271] Reintroduce existing token revocation for client credentials.
52
+
53
+ **[IMPORTANT]** If you rely on being able to fetch multiple access tokens from the same
54
+ client using client credentials flow, you should skip to version 5.3, where this behaviour
55
+ is deactivated by default.
56
+
52
57
  - [#1269] Update initializer template documentation.
53
58
  - [#1266] Use strong parameters within pre-authorization.
54
59
  - [#1264] Add :before_successful_authorization and :after_successful_authorization hooks in TokensController
@@ -258,6 +258,7 @@ module Doorkeeper
258
258
  option :active_record_options, default: {}
259
259
  option :grant_flows, default: %w[authorization_code client_credentials]
260
260
  option :handle_auth_errors, default: :render
261
+ option :token_lookup_batch_size, default: 10_000
261
262
 
262
263
  # Allows to customize OAuth grant flows that +each+ application support.
263
264
  # You can configure a custom block (or use a class respond to `#call`) that must
@@ -110,8 +110,9 @@ module Doorkeeper
110
110
  return nil unless relation
111
111
 
112
112
  matching_tokens = []
113
+ batch_size = Doorkeeper.configuration.token_lookup_batch_size
113
114
 
114
- find_access_token_in_batches(relation) do |batch|
115
+ find_access_token_in_batches(relation, batch_size: batch_size) do |batch|
115
116
  tokens = batch.select do |token|
116
117
  scopes_match?(token.scopes, scopes, application.try(:scopes))
117
118
  end
@@ -9,7 +9,7 @@ module Doorkeeper
9
9
  # Semantic versioning
10
10
  MAJOR = 5
11
11
  MINOR = 2
12
- TINY = 3
12
+ TINY = 4
13
13
  PRE = nil
14
14
 
15
15
  # Full version number
@@ -88,6 +88,14 @@ Doorkeeper.configure do
88
88
  #
89
89
  # reuse_access_token
90
90
 
91
+ # In case you enabled `reuse_access_token` option Doorkeeper will try to find matching
92
+ # token using `matching_token_for` Access Token API that searches for valid records
93
+ # in batches in order not to pollute the memory with all the database records. By default
94
+ # Doorkeeper uses batch size of 10 000 records. You can increase or decrease this value
95
+ # depending on your needs and server capabilities.
96
+ #
97
+ # token_lookup_batch_size 10_000
98
+
91
99
  # Set a limit for token_reuse if using reuse_access_token option
92
100
  #
93
101
  # This option limits token_reusability to some extent.
@@ -588,6 +588,21 @@ describe Doorkeeper, "configuration" do
588
588
  end
589
589
  end
590
590
 
591
+ describe "token_lookup_batch_size" do
592
+ it "uses default doorkeeper value" do
593
+ expect(subject.token_lookup_batch_size).to eq(10_000)
594
+ end
595
+
596
+ it "can change the value" do
597
+ Doorkeeper.configure do
598
+ orm DOORKEEPER_ORM
599
+ token_lookup_batch_size 100_000
600
+ end
601
+
602
+ expect(subject.token_lookup_batch_size).to eq(100_000)
603
+ end
604
+ end
605
+
591
606
  describe "strict_content_type" do
592
607
  it "is false by default" do
593
608
  expect(subject.enforce_content_type).to eq(false)
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.3
4
+ version: 5.2.4
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: 2019-12-12 00:00:00.000000000 Z
14
+ date: 2020-02-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: railties