doorkeeper 5.2.6 → 5.3.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.

Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +2 -2
  3. data/CHANGELOG.md +15 -14
  4. data/Gemfile +2 -2
  5. data/app/controllers/doorkeeper/application_controller.rb +2 -2
  6. data/app/controllers/doorkeeper/application_metal_controller.rb +2 -2
  7. data/app/controllers/doorkeeper/applications_controller.rb +3 -3
  8. data/app/controllers/doorkeeper/authorizations_controller.rb +2 -2
  9. data/app/controllers/doorkeeper/authorized_applications_controller.rb +3 -3
  10. data/gemfiles/rails_5_0.gemfile +2 -2
  11. data/gemfiles/rails_5_1.gemfile +2 -2
  12. data/gemfiles/rails_5_2.gemfile +2 -2
  13. data/gemfiles/rails_6_0.gemfile +2 -2
  14. data/gemfiles/rails_master.gemfile +2 -2
  15. data/lib/doorkeeper.rb +2 -3
  16. data/lib/doorkeeper/config.rb +71 -39
  17. data/lib/doorkeeper/grape/helpers.rb +1 -1
  18. data/lib/doorkeeper/helpers/controller.rb +10 -8
  19. data/lib/doorkeeper/models/access_grant_mixin.rb +7 -6
  20. data/lib/doorkeeper/models/access_token_mixin.rb +55 -18
  21. data/lib/doorkeeper/models/application_mixin.rb +3 -3
  22. data/lib/doorkeeper/models/concerns/ownership.rb +1 -1
  23. data/lib/doorkeeper/models/concerns/reusable.rb +1 -1
  24. data/lib/doorkeeper/models/concerns/revocable.rb +0 -27
  25. data/lib/doorkeeper/oauth/authorization/code.rb +4 -4
  26. data/lib/doorkeeper/oauth/authorization/token.rb +9 -6
  27. data/lib/doorkeeper/oauth/authorization_code_request.rb +13 -6
  28. data/lib/doorkeeper/oauth/base_request.rb +8 -4
  29. data/lib/doorkeeper/oauth/client.rb +7 -8
  30. data/lib/doorkeeper/oauth/client_credentials/creator.rb +16 -9
  31. data/lib/doorkeeper/oauth/client_credentials/issuer.rb +7 -7
  32. data/lib/doorkeeper/oauth/client_credentials/{validation.rb → validator.rb} +4 -4
  33. data/lib/doorkeeper/oauth/client_credentials_request.rb +1 -1
  34. data/lib/doorkeeper/oauth/code_response.rb +2 -2
  35. data/lib/doorkeeper/oauth/error.rb +1 -1
  36. data/lib/doorkeeper/oauth/error_response.rb +5 -5
  37. data/lib/doorkeeper/oauth/helpers/scope_checker.rb +7 -5
  38. data/lib/doorkeeper/oauth/helpers/unique_token.rb +8 -5
  39. data/lib/doorkeeper/oauth/helpers/uri_checker.rb +1 -1
  40. data/lib/doorkeeper/oauth/invalid_request_response.rb +3 -3
  41. data/lib/doorkeeper/oauth/invalid_token_response.rb +5 -2
  42. data/lib/doorkeeper/oauth/password_access_token_request.rb +3 -3
  43. data/lib/doorkeeper/oauth/pre_authorization.rb +7 -5
  44. data/lib/doorkeeper/oauth/refresh_token_request.rb +5 -5
  45. data/lib/doorkeeper/oauth/token.rb +2 -2
  46. data/lib/doorkeeper/oauth/token_introspection.rb +6 -6
  47. data/lib/doorkeeper/orm/active_record.rb +3 -3
  48. data/lib/doorkeeper/orm/active_record/access_grant.rb +4 -43
  49. data/lib/doorkeeper/orm/active_record/access_token.rb +4 -35
  50. data/lib/doorkeeper/orm/active_record/application.rb +3 -155
  51. data/lib/doorkeeper/orm/active_record/mixins/access_grant.rb +53 -0
  52. data/lib/doorkeeper/orm/active_record/mixins/access_token.rb +47 -0
  53. data/lib/doorkeeper/orm/active_record/mixins/application.rb +128 -0
  54. data/lib/doorkeeper/orm/active_record/redirect_uri_validator.rb +3 -3
  55. data/lib/doorkeeper/rails/helpers.rb +4 -4
  56. data/lib/doorkeeper/rails/routes.rb +5 -7
  57. data/lib/doorkeeper/rake/db.rake +3 -3
  58. data/lib/doorkeeper/request.rb +1 -1
  59. data/lib/doorkeeper/request/authorization_code.rb +3 -3
  60. data/lib/doorkeeper/request/client_credentials.rb +2 -2
  61. data/lib/doorkeeper/request/password.rb +2 -2
  62. data/lib/doorkeeper/request/refresh_token.rb +3 -3
  63. data/lib/doorkeeper/server.rb +1 -1
  64. data/lib/doorkeeper/stale_records_cleaner.rb +1 -1
  65. data/lib/doorkeeper/version.rb +2 -2
  66. data/lib/generators/doorkeeper/application_owner_generator.rb +1 -1
  67. data/lib/generators/doorkeeper/confidential_applications_generator.rb +1 -1
  68. data/lib/generators/doorkeeper/migration_generator.rb +1 -1
  69. data/lib/generators/doorkeeper/pkce_generator.rb +1 -1
  70. data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +2 -2
  71. data/lib/generators/doorkeeper/templates/initializer.rb +39 -8
  72. data/spec/controllers/application_metal_controller_spec.rb +1 -1
  73. data/spec/controllers/applications_controller_spec.rb +3 -2
  74. data/spec/controllers/authorizations_controller_spec.rb +18 -18
  75. data/spec/controllers/protected_resources_controller_spec.rb +25 -17
  76. data/spec/controllers/token_info_controller_spec.rb +1 -1
  77. data/spec/controllers/tokens_controller_spec.rb +1 -1
  78. data/spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb +3 -3
  79. data/spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb +1 -1
  80. data/spec/dummy/db/migrate/20180210183654_add_confidential_to_applications.rb +1 -1
  81. data/spec/generators/install_generator_spec.rb +1 -1
  82. data/spec/generators/previous_refresh_token_generator_spec.rb +2 -2
  83. data/spec/helpers/doorkeeper/dashboard_helper_spec.rb +1 -1
  84. data/spec/lib/config_spec.rb +61 -21
  85. data/spec/lib/doorkeeper_spec.rb +1 -1
  86. data/spec/lib/models/revocable_spec.rb +3 -3
  87. data/spec/lib/oauth/authorization_code_request_spec.rb +127 -125
  88. data/spec/lib/oauth/base_request_spec.rb +160 -158
  89. data/spec/lib/oauth/base_response_spec.rb +27 -29
  90. data/spec/lib/oauth/client/credentials_spec.rb +1 -1
  91. data/spec/lib/oauth/client_credentials/creator_spec.rb +42 -5
  92. data/spec/lib/oauth/client_credentials/issuer_spec.rb +12 -12
  93. data/spec/lib/oauth/client_credentials/validation_spec.rb +4 -4
  94. data/spec/lib/oauth/client_credentials_integration_spec.rb +16 -18
  95. data/spec/lib/oauth/client_credentials_request_spec.rb +78 -80
  96. data/spec/lib/oauth/client_spec.rb +26 -26
  97. data/spec/lib/oauth/code_request_spec.rb +34 -34
  98. data/spec/lib/oauth/code_response_spec.rb +21 -25
  99. data/spec/lib/oauth/error_response_spec.rb +42 -44
  100. data/spec/lib/oauth/error_spec.rb +12 -14
  101. data/spec/lib/oauth/forbidden_token_response_spec.rb +11 -13
  102. data/spec/lib/oauth/helpers/scope_checker_spec.rb +30 -18
  103. data/spec/lib/oauth/invalid_request_response_spec.rb +48 -50
  104. data/spec/lib/oauth/invalid_token_response_spec.rb +32 -34
  105. data/spec/lib/oauth/password_access_token_request_spec.rb +145 -147
  106. data/spec/lib/oauth/pre_authorization_spec.rb +159 -161
  107. data/spec/lib/oauth/refresh_token_request_spec.rb +138 -139
  108. data/spec/lib/oauth/scopes_spec.rb +104 -106
  109. data/spec/lib/oauth/token_request_spec.rb +115 -111
  110. data/spec/lib/oauth/token_response_spec.rb +71 -73
  111. data/spec/lib/oauth/token_spec.rb +121 -123
  112. data/spec/models/doorkeeper/access_grant_spec.rb +3 -5
  113. data/spec/models/doorkeeper/access_token_spec.rb +7 -7
  114. data/spec/models/doorkeeper/application_spec.rb +295 -373
  115. data/spec/requests/applications/applications_request_spec.rb +1 -1
  116. data/spec/requests/endpoints/authorization_spec.rb +5 -3
  117. data/spec/requests/flows/authorization_code_spec.rb +34 -22
  118. data/spec/requests/flows/client_credentials_spec.rb +1 -1
  119. data/spec/requests/flows/password_spec.rb +32 -12
  120. data/spec/requests/flows/refresh_token_spec.rb +19 -19
  121. data/spec/requests/flows/revoke_token_spec.rb +18 -12
  122. data/spec/spec_helper.rb +1 -4
  123. data/spec/support/shared/controllers_shared_context.rb +33 -23
  124. data/spec/validators/redirect_uri_validator_spec.rb +1 -1
  125. metadata +6 -5
  126. data/spec/support/http_method_shim.rb +0 -29
@@ -36,21 +36,25 @@ module Doorkeeper
36
36
 
37
37
  def find_or_create_access_token(client, resource_owner_id, scopes, server)
38
38
  context = Authorization::Token.build_context(client, grant_type, scopes)
39
- @access_token = AccessToken.find_or_create_for(
39
+ @access_token = server_config.access_token_model.find_or_create_for(
40
40
  client,
41
41
  resource_owner_id,
42
42
  scopes,
43
43
  Authorization::Token.access_token_expires_in(server, context),
44
- Authorization::Token.refresh_token_enabled?(server, context)
44
+ Authorization::Token.refresh_token_enabled?(server, context),
45
45
  )
46
46
  end
47
47
 
48
48
  def before_successful_response
49
- Doorkeeper.configuration.before_successful_strategy_response.call(self)
49
+ server_config.before_successful_strategy_response.call(self)
50
50
  end
51
51
 
52
52
  def after_successful_response
53
- Doorkeeper.configuration.after_successful_strategy_response.call(self, @response)
53
+ server_config.after_successful_strategy_response.call(self, @response)
54
+ end
55
+
56
+ def server_config
57
+ Doorkeeper.config
54
58
  end
55
59
 
56
60
  private
@@ -11,18 +11,17 @@ module Doorkeeper
11
11
  @application = application
12
12
  end
13
13
 
14
- def self.find(uid, method = Application.method(:by_uid))
15
- if (application = method.call(uid))
16
- new(application)
17
- end
14
+ def self.find(uid, method = Doorkeeper.config.application_model.method(:by_uid))
15
+ return unless (application = method.call(uid))
16
+
17
+ new(application)
18
18
  end
19
19
 
20
- def self.authenticate(credentials, method = Application.method(:by_uid_and_secret))
20
+ def self.authenticate(credentials, method = Doorkeeper.config.application_model.method(:by_uid_and_secret))
21
21
  return if credentials.blank?
22
+ return unless (application = method.call(credentials.uid, credentials.secret))
22
23
 
23
- if (application = method.call(credentials.uid, credentials.secret))
24
- new(application)
25
- end
24
+ new(application)
26
25
  end
27
26
  end
28
27
  end
@@ -5,24 +5,31 @@ module Doorkeeper
5
5
  class ClientCredentialsRequest < BaseRequest
6
6
  class Creator
7
7
  def call(client, scopes, attributes = {})
8
- existing_token = existing_token_for(client, scopes)
8
+ if lookup_existing_token?
9
+ existing_token = find_existing_token_for(client, scopes)
10
+ return existing_token if server_config.reuse_access_token && existing_token&.reusable?
9
11
 
10
- if Doorkeeper.configuration.reuse_access_token && existing_token&.reusable?
11
- return existing_token
12
+ existing_token&.revoke if server_config.revoke_previous_client_credentials_token
12
13
  end
13
14
 
14
- existing_token&.revoke
15
-
16
- AccessToken.find_or_create_for(
15
+ server_config.access_token_model.find_or_create_for(
17
16
  client, nil, scopes, attributes[:expires_in],
18
- attributes[:use_refresh_token]
17
+ attributes[:use_refresh_token],
19
18
  )
20
19
  end
21
20
 
22
21
  private
23
22
 
24
- def existing_token_for(client, scopes)
25
- Doorkeeper::AccessToken.matching_token_for client, nil, scopes
23
+ def lookup_existing_token?
24
+ server_config.reuse_access_token || server_config.revoke_previous_client_credentials_token
25
+ end
26
+
27
+ def find_existing_token_for(client, scopes)
28
+ server_config.access_token_model.matching_token_for(client, nil, scopes)
29
+ end
30
+
31
+ def server_config
32
+ Doorkeeper.config
26
33
  end
27
34
  end
28
35
  end
@@ -4,20 +4,20 @@ module Doorkeeper
4
4
  module OAuth
5
5
  class ClientCredentialsRequest < BaseRequest
6
6
  class Issuer
7
- attr_accessor :token, :validation, :error
7
+ attr_accessor :token, :validator, :error
8
8
 
9
- def initialize(server, validation)
9
+ def initialize(server, validator)
10
10
  @server = server
11
- @validation = validation
11
+ @validator = validator
12
12
  end
13
13
 
14
14
  def create(client, scopes, creator = Creator.new)
15
- if validation.valid?
15
+ if validator.valid?
16
16
  @token = create_token(client, scopes, creator)
17
17
  @error = :server_error unless @token
18
18
  else
19
19
  @token = false
20
- @error = validation.error
20
+ @error = validator.error
21
21
  end
22
22
  @token
23
23
  end
@@ -28,7 +28,7 @@ module Doorkeeper
28
28
  context = Authorization::Token.build_context(
29
29
  client,
30
30
  Doorkeeper::OAuth::CLIENT_CREDENTIALS,
31
- scopes
31
+ scopes,
32
32
  )
33
33
  ttl = Authorization::Token.access_token_expires_in(@server, context)
34
34
 
@@ -36,7 +36,7 @@ module Doorkeeper
36
36
  client,
37
37
  scopes,
38
38
  use_refresh_token: false,
39
- expires_in: ttl
39
+ expires_in: ttl,
40
40
  )
41
41
  end
42
42
  end
@@ -3,7 +3,7 @@
3
3
  module Doorkeeper
4
4
  module OAuth
5
5
  class ClientCredentialsRequest < BaseRequest
6
- class Validation
6
+ class Validator
7
7
  include Validations
8
8
  include OAuth::Helpers
9
9
 
@@ -26,9 +26,9 @@ module Doorkeeper
26
26
  end
27
27
 
28
28
  def validate_client_supports_grant_flow
29
- Doorkeeper.configuration.allow_grant_flow_for_client?(
29
+ Doorkeeper.config.allow_grant_flow_for_client?(
30
30
  Doorkeeper::OAuth::CLIENT_CREDENTIALS,
31
- @client
31
+ @client,
32
32
  )
33
33
  end
34
34
 
@@ -45,7 +45,7 @@ module Doorkeeper
45
45
  scope_str: @request.scopes.to_s,
46
46
  server_scopes: @server.scopes,
47
47
  app_scopes: application_scopes,
48
- grant_type: Doorkeeper::OAuth::CLIENT_CREDENTIALS
48
+ grant_type: Doorkeeper::OAuth::CLIENT_CREDENTIALS,
49
49
  )
50
50
  end
51
51
  end
@@ -12,7 +12,7 @@ module Doorkeeper
12
12
  delegate :error, to: :issuer
13
13
 
14
14
  def issuer
15
- @issuer ||= Issuer.new(server, Validation.new(server, self))
15
+ @issuer ||= Issuer.new(server, Validator.new(server, self))
16
16
  end
17
17
 
18
18
  def initialize(server, client, parameters = {})
@@ -26,13 +26,13 @@ module Doorkeeper
26
26
  access_token: auth.token.plaintext_token,
27
27
  token_type: auth.token.token_type,
28
28
  expires_in: auth.token.expires_in_seconds,
29
- state: pre_auth.state
29
+ state: pre_auth.state,
30
30
  )
31
31
  else
32
32
  Authorization::URIBuilder.uri_with_query(
33
33
  pre_auth.redirect_uri,
34
34
  code: auth.token.plaintext_token,
35
- state: pre_auth.state
35
+ state: pre_auth.state,
36
36
  )
37
37
  end
38
38
  end
@@ -7,7 +7,7 @@ module Doorkeeper
7
7
  I18n.translate(
8
8
  name,
9
9
  scope: %i[doorkeeper errors messages],
10
- default: :server_error
10
+ default: :server_error,
11
11
  )
12
12
  end
13
13
  end
@@ -10,8 +10,8 @@ module Doorkeeper
10
10
  attributes.merge(
11
11
  name: request.error,
12
12
  state: request.try(:state),
13
- redirect_uri: request.try(:redirect_uri)
14
- )
13
+ redirect_uri: request.try(:redirect_uri),
14
+ ),
15
15
  )
16
16
  end
17
17
 
@@ -46,9 +46,9 @@ module Doorkeeper
46
46
 
47
47
  def redirect_uri
48
48
  if @response_on_fragment
49
- Authorization::URIBuilder.uri_with_fragment @redirect_uri, body
49
+ Authorization::URIBuilder.uri_with_fragment(@redirect_uri, body)
50
50
  else
51
- Authorization::URIBuilder.uri_with_query @redirect_uri, body
51
+ Authorization::URIBuilder.uri_with_query(@redirect_uri, body)
52
52
  end
53
53
  end
54
54
 
@@ -70,7 +70,7 @@ module Doorkeeper
70
70
  delegate :realm, to: :configuration
71
71
 
72
72
  def configuration
73
- Doorkeeper.configuration
73
+ Doorkeeper.config
74
74
  end
75
75
 
76
76
  def exception_class
@@ -13,7 +13,7 @@ module Doorkeeper
13
13
  @valid_scopes = valid_scopes(server_scopes, app_scopes)
14
14
 
15
15
  if grant_type
16
- @scopes_by_grant_type = Doorkeeper.configuration.scopes_by_grant_type[grant_type.to_sym]
16
+ @scopes_by_grant_type = Doorkeeper.config.scopes_by_grant_type[grant_type.to_sym]
17
17
  end
18
18
  end
19
19
 
@@ -43,10 +43,12 @@ module Doorkeeper
43
43
  end
44
44
 
45
45
  def self.valid?(scope_str:, server_scopes:, app_scopes: nil, grant_type: nil)
46
- Validator.new(scope_str,
47
- server_scopes,
48
- app_scopes,
49
- grant_type).valid?
46
+ Validator.new(
47
+ scope_str,
48
+ server_scopes,
49
+ app_scopes,
50
+ grant_type,
51
+ ).valid?
50
52
  end
51
53
  end
52
54
  end
@@ -3,6 +3,9 @@
3
3
  module Doorkeeper
4
4
  module OAuth
5
5
  module Helpers
6
+ # Default Doorkeeper token generator. Follows OAuth RFC and
7
+ # could be customized using `default_generator_method` in
8
+ # configuration.
6
9
  module UniqueToken
7
10
  def self.generate(options = {})
8
11
  # Access Token value must be 1*VSCHAR or
@@ -11,15 +14,15 @@ module Doorkeeper
11
14
  # @see https://tools.ietf.org/html/rfc6749#appendix-A.12
12
15
  # @see https://tools.ietf.org/html/rfc6750#section-2.1
13
16
  #
14
- generator_method = options.delete(:generator) || SecureRandom.method(self.generator_method)
15
- token_size = options.delete(:size) || 32
16
- generator_method.call(token_size)
17
+ generator = options.delete(:generator) || SecureRandom.method(default_generator_method)
18
+ token_size = options.delete(:size) || 32
19
+ generator.call(token_size)
17
20
  end
18
21
 
19
22
  # Generator method for default generator class (SecureRandom)
20
23
  #
21
- def self.generator_method
22
- Doorkeeper.configuration.default_generator_method
24
+ def self.default_generator_method
25
+ Doorkeeper.config.default_generator_method
23
26
  end
24
27
  end
25
28
  end
@@ -18,7 +18,7 @@ module Doorkeeper
18
18
 
19
19
  # For backward compatibility with old rubies
20
20
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.5.0")
21
- IPAddr.send(:include, Doorkeeper::IPAddrLoopback)
21
+ IPAddr.include Doorkeeper::IPAddrLoopback
22
22
  end
23
23
 
24
24
  module OAuth
@@ -11,8 +11,8 @@ module Doorkeeper
11
11
  state: request.try(:state),
12
12
  redirect_uri: request.try(:redirect_uri),
13
13
  missing_param: request.try(:missing_param),
14
- reason: request.try(:invalid_request_reason)
15
- )
14
+ reason: request.try(:invalid_request_reason),
15
+ ),
16
16
  )
17
17
  end
18
18
 
@@ -31,7 +31,7 @@ module Doorkeeper
31
31
  reason,
32
32
  scope: %i[doorkeeper errors messages invalid_request],
33
33
  default: :unknown,
34
- value: @missing_param
34
+ value: @missing_param,
35
35
  )
36
36
  end
37
37
 
@@ -27,8 +27,11 @@ module Doorkeeper
27
27
  end
28
28
 
29
29
  def description
30
- scope = { scope: %i[doorkeeper errors messages invalid_token] }
31
- @description ||= I18n.translate @reason, scope
30
+ @description ||=
31
+ I18n.translate(
32
+ @reason,
33
+ scope: %i[doorkeeper errors messages invalid_token],
34
+ )
32
35
  end
33
36
 
34
37
  protected
@@ -37,12 +37,12 @@ module Doorkeeper
37
37
  scope_str: scopes.to_s,
38
38
  server_scopes: server.scopes,
39
39
  app_scopes: client_scopes,
40
- grant_type: grant_type
40
+ grant_type: grant_type,
41
41
  )
42
42
  end
43
43
 
44
44
  def validate_resource_owner
45
- !resource_owner.nil?
45
+ resource_owner.present?
46
46
  end
47
47
 
48
48
  def validate_client
@@ -50,7 +50,7 @@ module Doorkeeper
50
50
  end
51
51
 
52
52
  def validate_client_supports_grant_flow
53
- Doorkeeper.configuration.allow_grant_flow_for_client?(grant_type, client)
53
+ server_config.allow_grant_flow_for_client?(grant_type, client)
54
54
  end
55
55
  end
56
56
  end
@@ -33,7 +33,7 @@ module Doorkeeper
33
33
  end
34
34
 
35
35
  def validate_client_supports_grant_flow
36
- Doorkeeper.configuration.allow_grant_flow_for_client?(grant_type, client.application)
36
+ Doorkeeper.config.allow_grant_flow_for_client?(grant_type, client.application)
37
37
  end
38
38
 
39
39
  def scopes
@@ -46,8 +46,10 @@ module Doorkeeper
46
46
 
47
47
  def error_response
48
48
  if error == :invalid_request
49
- OAuth::InvalidRequestResponse.from_request(self,
50
- response_on_fragment: response_on_fragment?)
49
+ OAuth::InvalidRequestResponse.from_request(
50
+ self,
51
+ response_on_fragment: response_on_fragment?,
52
+ )
51
53
  else
52
54
  OAuth::ErrorResponse.from_request(self, response_on_fragment: response_on_fragment?)
53
55
  end
@@ -86,7 +88,7 @@ module Doorkeeper
86
88
 
87
89
  Helpers::URIChecker.valid_for_authorization?(
88
90
  redirect_uri,
89
- client.redirect_uri
91
+ client.redirect_uri,
90
92
  )
91
93
  end
92
94
 
@@ -109,7 +111,7 @@ module Doorkeeper
109
111
  scope_str: scope,
110
112
  server_scopes: server.scopes,
111
113
  app_scopes: client.scopes,
112
- grant_type: grant_type
114
+ grant_type: grant_type,
113
115
  )
114
116
  end
115
117
 
@@ -27,7 +27,7 @@ module Doorkeeper
27
27
  private
28
28
 
29
29
  def load_client(credentials)
30
- Application.by_uid_and_secret(credentials.uid, credentials.secret)
30
+ server_config.application_model.by_uid_and_secret(credentials.uid, credentials.secret)
31
31
  end
32
32
 
33
33
  def before_successful_response
@@ -42,7 +42,7 @@ module Doorkeeper
42
42
  end
43
43
 
44
44
  def refresh_token_revoked_on_use?
45
- Doorkeeper::AccessToken.refresh_token_revoked_on_use?
45
+ server_config.access_token_model.refresh_token_revoked_on_use?
46
46
  end
47
47
 
48
48
  def default_scopes
@@ -50,7 +50,7 @@ module Doorkeeper
50
50
  end
51
51
 
52
52
  def create_access_token
53
- @access_token = AccessToken.create!(access_token_attributes)
53
+ @access_token = server_config.access_token_model.create!(access_token_attributes)
54
54
  end
55
55
 
56
56
  def access_token_attributes
@@ -71,7 +71,7 @@ module Doorkeeper
71
71
  context = Authorization::Token.build_context(
72
72
  client,
73
73
  Doorkeeper::OAuth::REFRESH_TOKEN,
74
- scopes
74
+ scopes,
75
75
  )
76
76
  Authorization::Token.access_token_expires_in(server, context)
77
77
  end
@@ -104,7 +104,7 @@ module Doorkeeper
104
104
  if @original_scopes.present?
105
105
  ScopeChecker.valid?(
106
106
  scope_str: @original_scopes,
107
- server_scopes: refresh_token.scopes
107
+ server_scopes: refresh_token.scopes,
108
108
  )
109
109
  else
110
110
  true