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.
- checksums.yaml +4 -4
- data/Appraisals +2 -2
- data/CHANGELOG.md +15 -14
- data/Gemfile +2 -2
- data/app/controllers/doorkeeper/application_controller.rb +2 -2
- data/app/controllers/doorkeeper/application_metal_controller.rb +2 -2
- data/app/controllers/doorkeeper/applications_controller.rb +3 -3
- data/app/controllers/doorkeeper/authorizations_controller.rb +2 -2
- data/app/controllers/doorkeeper/authorized_applications_controller.rb +3 -3
- data/gemfiles/rails_5_0.gemfile +2 -2
- data/gemfiles/rails_5_1.gemfile +2 -2
- data/gemfiles/rails_5_2.gemfile +2 -2
- data/gemfiles/rails_6_0.gemfile +2 -2
- data/gemfiles/rails_master.gemfile +2 -2
- data/lib/doorkeeper.rb +2 -3
- data/lib/doorkeeper/config.rb +71 -39
- data/lib/doorkeeper/grape/helpers.rb +1 -1
- data/lib/doorkeeper/helpers/controller.rb +10 -8
- data/lib/doorkeeper/models/access_grant_mixin.rb +7 -6
- data/lib/doorkeeper/models/access_token_mixin.rb +55 -18
- data/lib/doorkeeper/models/application_mixin.rb +3 -3
- data/lib/doorkeeper/models/concerns/ownership.rb +1 -1
- data/lib/doorkeeper/models/concerns/reusable.rb +1 -1
- data/lib/doorkeeper/models/concerns/revocable.rb +0 -27
- data/lib/doorkeeper/oauth/authorization/code.rb +4 -4
- data/lib/doorkeeper/oauth/authorization/token.rb +9 -6
- data/lib/doorkeeper/oauth/authorization_code_request.rb +13 -6
- data/lib/doorkeeper/oauth/base_request.rb +8 -4
- data/lib/doorkeeper/oauth/client.rb +7 -8
- data/lib/doorkeeper/oauth/client_credentials/creator.rb +16 -9
- data/lib/doorkeeper/oauth/client_credentials/issuer.rb +7 -7
- data/lib/doorkeeper/oauth/client_credentials/{validation.rb → validator.rb} +4 -4
- data/lib/doorkeeper/oauth/client_credentials_request.rb +1 -1
- data/lib/doorkeeper/oauth/code_response.rb +2 -2
- data/lib/doorkeeper/oauth/error.rb +1 -1
- data/lib/doorkeeper/oauth/error_response.rb +5 -5
- data/lib/doorkeeper/oauth/helpers/scope_checker.rb +7 -5
- data/lib/doorkeeper/oauth/helpers/unique_token.rb +8 -5
- data/lib/doorkeeper/oauth/helpers/uri_checker.rb +1 -1
- data/lib/doorkeeper/oauth/invalid_request_response.rb +3 -3
- data/lib/doorkeeper/oauth/invalid_token_response.rb +5 -2
- data/lib/doorkeeper/oauth/password_access_token_request.rb +3 -3
- data/lib/doorkeeper/oauth/pre_authorization.rb +7 -5
- data/lib/doorkeeper/oauth/refresh_token_request.rb +5 -5
- data/lib/doorkeeper/oauth/token.rb +2 -2
- data/lib/doorkeeper/oauth/token_introspection.rb +6 -6
- data/lib/doorkeeper/orm/active_record.rb +3 -3
- data/lib/doorkeeper/orm/active_record/access_grant.rb +4 -43
- data/lib/doorkeeper/orm/active_record/access_token.rb +4 -35
- data/lib/doorkeeper/orm/active_record/application.rb +3 -155
- data/lib/doorkeeper/orm/active_record/mixins/access_grant.rb +53 -0
- data/lib/doorkeeper/orm/active_record/mixins/access_token.rb +47 -0
- data/lib/doorkeeper/orm/active_record/mixins/application.rb +128 -0
- data/lib/doorkeeper/orm/active_record/redirect_uri_validator.rb +3 -3
- data/lib/doorkeeper/rails/helpers.rb +4 -4
- data/lib/doorkeeper/rails/routes.rb +5 -7
- data/lib/doorkeeper/rake/db.rake +3 -3
- data/lib/doorkeeper/request.rb +1 -1
- data/lib/doorkeeper/request/authorization_code.rb +3 -3
- data/lib/doorkeeper/request/client_credentials.rb +2 -2
- data/lib/doorkeeper/request/password.rb +2 -2
- data/lib/doorkeeper/request/refresh_token.rb +3 -3
- data/lib/doorkeeper/server.rb +1 -1
- data/lib/doorkeeper/stale_records_cleaner.rb +1 -1
- data/lib/doorkeeper/version.rb +2 -2
- data/lib/generators/doorkeeper/application_owner_generator.rb +1 -1
- data/lib/generators/doorkeeper/confidential_applications_generator.rb +1 -1
- data/lib/generators/doorkeeper/migration_generator.rb +1 -1
- data/lib/generators/doorkeeper/pkce_generator.rb +1 -1
- data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +2 -2
- data/lib/generators/doorkeeper/templates/initializer.rb +39 -8
- data/spec/controllers/application_metal_controller_spec.rb +1 -1
- data/spec/controllers/applications_controller_spec.rb +3 -2
- data/spec/controllers/authorizations_controller_spec.rb +18 -18
- data/spec/controllers/protected_resources_controller_spec.rb +25 -17
- data/spec/controllers/token_info_controller_spec.rb +1 -1
- data/spec/controllers/tokens_controller_spec.rb +1 -1
- data/spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb +3 -3
- data/spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb +1 -1
- data/spec/dummy/db/migrate/20180210183654_add_confidential_to_applications.rb +1 -1
- data/spec/generators/install_generator_spec.rb +1 -1
- data/spec/generators/previous_refresh_token_generator_spec.rb +2 -2
- data/spec/helpers/doorkeeper/dashboard_helper_spec.rb +1 -1
- data/spec/lib/config_spec.rb +61 -21
- data/spec/lib/doorkeeper_spec.rb +1 -1
- data/spec/lib/models/revocable_spec.rb +3 -3
- data/spec/lib/oauth/authorization_code_request_spec.rb +127 -125
- data/spec/lib/oauth/base_request_spec.rb +160 -158
- data/spec/lib/oauth/base_response_spec.rb +27 -29
- data/spec/lib/oauth/client/credentials_spec.rb +1 -1
- data/spec/lib/oauth/client_credentials/creator_spec.rb +42 -5
- data/spec/lib/oauth/client_credentials/issuer_spec.rb +12 -12
- data/spec/lib/oauth/client_credentials/validation_spec.rb +4 -4
- data/spec/lib/oauth/client_credentials_integration_spec.rb +16 -18
- data/spec/lib/oauth/client_credentials_request_spec.rb +78 -80
- data/spec/lib/oauth/client_spec.rb +26 -26
- data/spec/lib/oauth/code_request_spec.rb +34 -34
- data/spec/lib/oauth/code_response_spec.rb +21 -25
- data/spec/lib/oauth/error_response_spec.rb +42 -44
- data/spec/lib/oauth/error_spec.rb +12 -14
- data/spec/lib/oauth/forbidden_token_response_spec.rb +11 -13
- data/spec/lib/oauth/helpers/scope_checker_spec.rb +30 -18
- data/spec/lib/oauth/invalid_request_response_spec.rb +48 -50
- data/spec/lib/oauth/invalid_token_response_spec.rb +32 -34
- data/spec/lib/oauth/password_access_token_request_spec.rb +145 -147
- data/spec/lib/oauth/pre_authorization_spec.rb +159 -161
- data/spec/lib/oauth/refresh_token_request_spec.rb +138 -139
- data/spec/lib/oauth/scopes_spec.rb +104 -106
- data/spec/lib/oauth/token_request_spec.rb +115 -111
- data/spec/lib/oauth/token_response_spec.rb +71 -73
- data/spec/lib/oauth/token_spec.rb +121 -123
- data/spec/models/doorkeeper/access_grant_spec.rb +3 -5
- data/spec/models/doorkeeper/access_token_spec.rb +7 -7
- data/spec/models/doorkeeper/application_spec.rb +295 -373
- data/spec/requests/applications/applications_request_spec.rb +1 -1
- data/spec/requests/endpoints/authorization_spec.rb +5 -3
- data/spec/requests/flows/authorization_code_spec.rb +34 -22
- data/spec/requests/flows/client_credentials_spec.rb +1 -1
- data/spec/requests/flows/password_spec.rb +32 -12
- data/spec/requests/flows/refresh_token_spec.rb +19 -19
- data/spec/requests/flows/revoke_token_spec.rb +18 -12
- data/spec/spec_helper.rb +1 -4
- data/spec/support/shared/controllers_shared_context.rb +33 -23
- data/spec/validators/redirect_uri_validator_spec.rb +1 -1
- metadata +6 -5
- 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 =
|
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
|
-
|
49
|
+
server_config.before_successful_strategy_response.call(self)
|
50
50
|
end
|
51
51
|
|
52
52
|
def after_successful_response
|
53
|
-
|
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 =
|
15
|
-
|
16
|
-
|
17
|
-
|
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 =
|
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
|
-
|
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
|
-
|
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
|
-
|
11
|
-
return existing_token
|
12
|
+
existing_token&.revoke if server_config.revoke_previous_client_credentials_token
|
12
13
|
end
|
13
14
|
|
14
|
-
|
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
|
25
|
-
|
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, :
|
7
|
+
attr_accessor :token, :validator, :error
|
8
8
|
|
9
|
-
def initialize(server,
|
9
|
+
def initialize(server, validator)
|
10
10
|
@server = server
|
11
|
-
@
|
11
|
+
@validator = validator
|
12
12
|
end
|
13
13
|
|
14
14
|
def create(client, scopes, creator = Creator.new)
|
15
|
-
if
|
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 =
|
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
|
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.
|
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
|
@@ -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
|
@@ -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
|
49
|
+
Authorization::URIBuilder.uri_with_fragment(@redirect_uri, body)
|
50
50
|
else
|
51
|
-
Authorization::URIBuilder.uri_with_query
|
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.
|
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.
|
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(
|
47
|
-
|
48
|
-
|
49
|
-
|
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
|
-
|
15
|
-
token_size
|
16
|
-
|
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.
|
22
|
-
Doorkeeper.
|
24
|
+
def self.default_generator_method
|
25
|
+
Doorkeeper.config.default_generator_method
|
23
26
|
end
|
24
27
|
end
|
25
28
|
end
|
@@ -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
|
-
|
31
|
-
|
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
|
-
|
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
|
-
|
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.
|
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(
|
50
|
-
|
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
|
-
|
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
|
-
|
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 =
|
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
|