doorkeeper 5.5.0.rc2 → 5.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71ef97409e242e0609d9c327836e2f90f92af440c8f989047b83435f7f8b052d
4
- data.tar.gz: f12a030d12ca321fbf1b0acd4534707afba6c584b77d307698943a879cd33500
3
+ metadata.gz: 8d0646462c8fd51891c70b06dbccf9d4c2a2db2d19f71fb9e358c9401843053a
4
+ data.tar.gz: 17669cf7be5a1f0053850c6f00c03b63df477438a7aa6805558d48dfb35541b0
5
5
  SHA512:
6
- metadata.gz: bdda34cda76caffdeaec38be0c06ba733cc15480970bd78b48267c66764a64643423d61a2adb6c1c65643d3df2061ab3d86ad82baf970676276d7b1655fb846b
7
- data.tar.gz: 8218ad9ad8248192f93253940623564784f339b78594cf00c000c33f9a6a9bd06f6cc5ee9fbcc207d4af3b499712387d39756c7ef6c709e9a7afe991efdfa5af
6
+ metadata.gz: 54c0fadb672bb09b4e33b6df5476694a0e7f1fb7795b3e2d4172e6c77671bbd7f929dec42f37d9b17bede5cb0659c5a95a30771fd8c69dbdddcb80d4d291aa81
7
+ data.tar.gz: 462977a3eae6d5705ce246814a66f0bd29cd64647e43ba4df2502b9b72eea9c0e848ce3c1789fa97cb6953a07661eef025665a9fa29a97080c1d61acc3e559b6
data/CHANGELOG.md CHANGED
@@ -5,10 +5,16 @@ upgrade guides.
5
5
 
6
6
  User-visible changes worth mentioning.
7
7
 
8
- ## master
8
+ ## main
9
9
 
10
10
  - [#PR ID] Add your PR description here.
11
11
 
12
+ ## 5.5.0
13
+
14
+ - [#1482] Simplify `TokenInfoController` to be overridable (extract response rendering).
15
+ - [#1478] Fix ownership association and Rake tasks when custom models configured.
16
+ - [#1477] Respect `ActiveRecord::Base.pluralize_table_names` for Doorkeeper table names.
17
+
12
18
  ## 5.5.0.rc2
13
19
 
14
20
  - [#1473] Enable `Applications` and `AuthorizedApplications` controllers in API mode.
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Doorkeeper — awesome OAuth 2 provider for your Rails / Grape app.
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/doorkeeper.svg)](https://rubygems.org/gems/doorkeeper)
4
- [![Build Status](https://travis-ci.org/doorkeeper-gem/doorkeeper.svg?branch=master)](https://travis-ci.org/doorkeeper-gem/doorkeeper)
4
+ [![Build Status](https://travis-ci.org/doorkeeper-gem/doorkeeper.svg?branch=main)](https://travis-ci.org/doorkeeper-gem/doorkeeper)
5
5
  [![Code Climate](https://codeclimate.com/github/doorkeeper-gem/doorkeeper.svg)](https://codeclimate.com/github/doorkeeper-gem/doorkeeper)
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
- [![Security](https://hakiri.io/github/doorkeeper-gem/doorkeeper/master.svg)](https://hakiri.io/github/doorkeeper-gem/doorkeeper/master)
6
+ [![Coverage Status](https://coveralls.io/repos/github/doorkeeper-gem/doorkeeper/badge.svg?branch=main)](https://coveralls.io/github/doorkeeper-gem/doorkeeper?branch=main)
7
+ [![Security](https://hakiri.io/github/doorkeeper-gem/doorkeeper/main.svg)](https://hakiri.io/github/doorkeeper-gem/doorkeeper/main)
8
8
  [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
9
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)
@@ -51,7 +51,7 @@ Supported features:
51
51
 
52
52
  ## Documentation
53
53
 
54
- This documentation is valid for `master` branch. Please check the documentation for the version of doorkeeper you are using in:
54
+ This documentation is valid for `main` branch. Please check the documentation for the version of doorkeeper you are using in:
55
55
  https://github.com/doorkeeper-gem/doorkeeper/releases.
56
56
 
57
57
  Additionally, other resources can be found on:
@@ -4,12 +4,22 @@ module Doorkeeper
4
4
  class TokenInfoController < Doorkeeper::ApplicationMetalController
5
5
  def show
6
6
  if doorkeeper_token&.accessible?
7
- render json: doorkeeper_token, status: :ok
7
+ render json: doorkeeper_token_to_json, status: :ok
8
8
  else
9
9
  error = OAuth::InvalidTokenResponse.new
10
10
  response.headers.merge!(error.headers)
11
- render json: error.body, status: error.status
11
+ render json: error_to_json(error), status: error.status
12
12
  end
13
13
  end
14
+
15
+ protected
16
+
17
+ def doorkeeper_token_to_json
18
+ doorkeeper_token
19
+ end
20
+
21
+ def error_to_json(error)
22
+ error.body
23
+ end
14
24
  end
15
25
  end
@@ -37,15 +37,7 @@ module Doorkeeper
37
37
  end
38
38
 
39
39
  def self.lazy_load(&block)
40
- # ActiveSupport has no public interface to check if something
41
- # already lazy-loaded :(
42
- loaded = ActiveSupport.instance_variable_get(:"@loaded") || {}
43
-
44
- if loaded.key?(:active_record)
45
- block.call
46
- else
47
- ActiveSupport.on_load(:active_record, {}, &block)
48
- end
40
+ ActiveSupport.on_load(:active_record, {}, &block)
49
41
  end
50
42
 
51
43
  def self.models
@@ -5,7 +5,7 @@ module Doorkeeper::Orm::ActiveRecord::Mixins
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- self.table_name = "#{table_name_prefix}oauth_access_grants#{table_name_suffix}"
8
+ self.table_name = compute_doorkeeper_table_name
9
9
 
10
10
  include ::Doorkeeper::AccessGrantMixin
11
11
 
@@ -54,5 +54,15 @@ module Doorkeeper::Orm::ActiveRecord::Mixins
54
54
  secret_strategy.store_secret(self, :token, @raw_token)
55
55
  end
56
56
  end
57
+
58
+ module ClassMethods
59
+ private
60
+
61
+ def compute_doorkeeper_table_name
62
+ table_name = "oauth_access_grant"
63
+ table_name = table_name.pluralize if pluralize_table_names
64
+ "#{table_name_prefix}#{table_name}#{table_name_suffix}"
65
+ end
66
+ end
57
67
  end
58
68
  end
@@ -5,7 +5,7 @@ module Doorkeeper::Orm::ActiveRecord::Mixins
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- self.table_name = "#{table_name_prefix}oauth_access_tokens#{table_name_suffix}"
8
+ self.table_name = compute_doorkeeper_table_name
9
9
 
10
10
  include ::Doorkeeper::AccessTokenMixin
11
11
 
@@ -46,6 +46,14 @@ module Doorkeeper::Orm::ActiveRecord::Mixins
46
46
  def refresh_token_revoked_on_use?
47
47
  column_names.include?("previous_refresh_token")
48
48
  end
49
+
50
+ private
51
+
52
+ def compute_doorkeeper_table_name
53
+ table_name = "oauth_access_token"
54
+ table_name = table_name.pluralize if pluralize_table_names
55
+ "#{table_name_prefix}#{table_name}#{table_name_suffix}"
56
+ end
49
57
  end
50
58
  end
51
59
  end
@@ -5,7 +5,7 @@ module Doorkeeper::Orm::ActiveRecord::Mixins
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- self.table_name = "#{table_name_prefix}oauth_applications#{table_name_suffix}"
8
+ self.table_name = compute_doorkeeper_table_name
9
9
 
10
10
  include ::Doorkeeper::ApplicationMixin
11
11
 
@@ -185,6 +185,14 @@ module Doorkeeper::Orm::ActiveRecord::Mixins
185
185
  Doorkeeper.config.access_token_model.revoke_all_for(id, resource_owner)
186
186
  Doorkeeper.config.access_grant_model.revoke_all_for(id, resource_owner)
187
187
  end
188
+
189
+ private
190
+
191
+ def compute_doorkeeper_table_name
192
+ table_name = "oauth_application"
193
+ table_name = table_name.pluralize if pluralize_table_names
194
+ "#{table_name_prefix}#{table_name}#{table_name_suffix}"
195
+ end
188
196
  end
189
197
  end
190
198
  end
@@ -13,7 +13,7 @@ namespace :doorkeeper do
13
13
  namespace :cleanup do
14
14
  desc "Removes stale access tokens"
15
15
  task revoked_tokens: "doorkeeper:setup" do
16
- cleaner = Doorkeeper::StaleRecordsCleaner.new(Doorkeeper::AccessToken)
16
+ cleaner = Doorkeeper::StaleRecordsCleaner.new(Doorkeeper.config.access_token_model)
17
17
  cleaner.clean_revoked
18
18
  end
19
19
 
@@ -26,13 +26,13 @@ namespace :doorkeeper do
26
26
 
27
27
  desc "Removes stale access grants"
28
28
  task revoked_grants: "doorkeeper:setup" do
29
- cleaner = Doorkeeper::StaleRecordsCleaner.new(Doorkeeper::AccessGrant)
29
+ cleaner = Doorkeeper::StaleRecordsCleaner.new(Doorkeeper.config.access_grant_model)
30
30
  cleaner.clean_revoked
31
31
  end
32
32
 
33
33
  desc "Removes expired (TTL passed) access grants"
34
34
  task expired_grants: "doorkeeper:setup" do
35
- cleaner = Doorkeeper::StaleRecordsCleaner.new(Doorkeeper::AccessGrant)
35
+ cleaner = Doorkeeper::StaleRecordsCleaner.new(Doorkeeper.config.access_grant_model)
36
36
  cleaner.clean_expired(Doorkeeper.config.authorization_code_expires_in)
37
37
  end
38
38
  end
@@ -2,5 +2,10 @@
2
2
 
3
3
  namespace :doorkeeper do
4
4
  task setup: :environment do
5
+ # Dirty hack to manually initialize AR because of lazy auto-loading,
6
+ # in other case we'll see NameError: uninitialized constant Doorkeeper::AccessToken
7
+ if Doorkeeper.config.orm == :active_record && defined?(::ActiveRecord::Base)
8
+ Object.const_get("::ActiveRecord::Base")
9
+ end
5
10
  end
6
11
  end
@@ -6,7 +6,7 @@ module Doorkeeper
6
6
  MAJOR = 5
7
7
  MINOR = 5
8
8
  TINY = 0
9
- PRE = "rc2"
9
+ PRE = nil
10
10
 
11
11
  # Full version number
12
12
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
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.5.0.rc2
4
+ version: 5.5.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: 2021-01-21 00:00:00.000000000 Z
14
+ date: 2021-02-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: railties
@@ -318,11 +318,11 @@ licenses:
318
318
  - MIT
319
319
  metadata:
320
320
  homepage_uri: https://github.com/doorkeeper-gem/doorkeeper
321
- changelog_uri: https://github.com/doorkeeper-gem/doorkeeper/blob/master/CHANGELOG.md
321
+ changelog_uri: https://github.com/doorkeeper-gem/doorkeeper/blob/main/CHANGELOG.md
322
322
  source_code_uri: https://github.com/doorkeeper-gem/doorkeeper
323
323
  bug_tracker_uri: https://github.com/doorkeeper-gem/doorkeeper/issues
324
324
  documentation_uri: https://doorkeeper.gitbook.io/guides/
325
- post_install_message: "Starting from 5.5.0.rc1 Doorkeeper requires client authentication
325
+ post_install_message: "Starting from 5.5.0 RC1 Doorkeeper requires client authentication
326
326
  for Resource Owner Password Grant\nas stated in the OAuth RFC. You have to create
327
327
  a new OAuth client (Doorkeeper::Application) if you didn't\nhave it before and use
328
328
  client credentials in HTTP Basic auth if you previously used this grant flow without\nclient
@@ -340,9 +340,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
340
340
  version: '2.4'
341
341
  required_rubygems_version: !ruby/object:Gem::Requirement
342
342
  requirements:
343
- - - ">"
343
+ - - ">="
344
344
  - !ruby/object:Gem::Version
345
- version: 1.3.1
345
+ version: '0'
346
346
  requirements: []
347
347
  rubygems_version: 3.1.2
348
348
  signing_key: