doorkeeper 5.6.0 → 5.6.1
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/CHANGELOG.md +6 -0
- data/lib/doorkeeper/config.rb +14 -0
- data/lib/doorkeeper/models/access_token_mixin.rb +1 -1
- data/lib/doorkeeper/models/concerns/expiration_time_sql_math.rb +1 -0
- data/lib/doorkeeper/oauth/authorization/token.rb +2 -1
- data/lib/doorkeeper/oauth/base_request.rb +2 -1
- data/lib/doorkeeper/oauth/client_credentials/creator.rb +2 -1
- data/lib/doorkeeper/rails/routes.rb +6 -2
- data/lib/doorkeeper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce1eaa79936bb41cc80803251a0467452fe07f2ffc00f4f2568a136d7d082775
|
4
|
+
data.tar.gz: 67803c41e4db2123e43af3adce5f9cbe6bdae3b845ddbbd83b4f0bfdc1c867fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46918fc44f2d6f98699457745fc7e5fe6ae851664b3f1d256173ef4638358f734f737f72ecf029d9676a942623222063f5b53771a7b3cc75624fd0a94dd8b051
|
7
|
+
data.tar.gz: e4134baf4b4f5757167fc4f11e12ef92066e884cb4988e2d667a3c6df53962e75ab39357b8022b320891653d362c5b4ea4b087e030847101da1419bdf1581ee2
|
data/CHANGELOG.md
CHANGED
@@ -9,6 +9,12 @@ User-visible changes worth mentioning.
|
|
9
9
|
|
10
10
|
- [#ID] Add your PR description here.
|
11
11
|
|
12
|
+
## 5.6.1
|
13
|
+
|
14
|
+
- [#1593] Add support for Trilogy ActiveRecord adapter.
|
15
|
+
- [#1597] Add optional support to use the url path for the native authorization code flow. Ports forward [#1143] from 4.4.3
|
16
|
+
- [#1599] Remove unnecessarily re-fetch of application object when creating an access token.
|
17
|
+
|
12
18
|
## 5.6.0
|
13
19
|
|
14
20
|
- [#1581] Consider `token_type_hint` when searching for access token in TokensController to avoid extra database calls.
|
data/lib/doorkeeper/config.rb
CHANGED
@@ -159,6 +159,15 @@ module Doorkeeper
|
|
159
159
|
@config.instance_variable_set(:@reuse_access_token, true)
|
160
160
|
end
|
161
161
|
|
162
|
+
# Choose to use the url path for native autorization codes
|
163
|
+
# Enabling this flag sets the authorization code response route for
|
164
|
+
# native redirect uris to oauth/authorize/<code>. The default is
|
165
|
+
# oauth/authorize/native?code=<code>.
|
166
|
+
# Rationale: https://github.com/doorkeeper-gem/doorkeeper/issues/1143
|
167
|
+
def use_url_path_for_native_authorization
|
168
|
+
@config.instance_variable_set(:@use_url_path_for_native_authorization, true)
|
169
|
+
end
|
170
|
+
|
162
171
|
# TODO: maybe make it more generic for other flows too?
|
163
172
|
# Only allow one valid access token obtained via client credentials
|
164
173
|
# per client. If a new access token is obtained before the old one
|
@@ -623,6 +632,11 @@ module Doorkeeper
|
|
623
632
|
def deprecated_token_grant_types_resolver
|
624
633
|
@deprecated_token_grant_types ||= calculate_token_grant_types
|
625
634
|
end
|
635
|
+
|
636
|
+
def native_authorization_code_route
|
637
|
+
@use_url_path_for_native_authorization = false unless defined?(@use_url_path_for_native_authorization)
|
638
|
+
@use_url_path_for_native_authorization ? '/:code' : '/native'
|
639
|
+
end
|
626
640
|
|
627
641
|
# [NOTE]: deprecated and will be removed soon
|
628
642
|
def deprecated_authorization_flows
|
@@ -212,7 +212,7 @@ module Doorkeeper
|
|
212
212
|
# @return [Doorkeeper::AccessToken] new access token
|
213
213
|
#
|
214
214
|
def create_for(application:, resource_owner:, scopes:, **token_attributes)
|
215
|
-
token_attributes[:
|
215
|
+
token_attributes[:application] = application
|
216
216
|
token_attributes[:scopes] = scopes.to_s
|
217
217
|
|
218
218
|
if Doorkeeper.config.polymorphic_resource_owner?
|
@@ -56,6 +56,7 @@ module Doorkeeper
|
|
56
56
|
"postgresql" => PostgresExpirationTimeSqlGenerator,
|
57
57
|
"mysql" => MySqlExpirationTimeSqlGenerator,
|
58
58
|
"mysql2" => MySqlExpirationTimeSqlGenerator,
|
59
|
+
"trilogy" => MySqlExpirationTimeSqlGenerator,
|
59
60
|
"sqlserver" => SqlServerExpirationTimeSqlGenerator,
|
60
61
|
"oracleenhanced" => OracleExpirationTimeSqlGenerator,
|
61
62
|
}.freeze
|
@@ -59,8 +59,9 @@ module Doorkeeper
|
|
59
59
|
resource_owner,
|
60
60
|
)
|
61
61
|
|
62
|
+
application = pre_auth.client.is_a?(Doorkeeper::Application) ? pre_auth.client : pre_auth.client.application if pre_auth.client
|
62
63
|
@token = Doorkeeper.config.access_token_model.find_or_create_for(
|
63
|
-
application:
|
64
|
+
application: application,
|
64
65
|
resource_owner: resource_owner,
|
65
66
|
scopes: pre_auth.scopes,
|
66
67
|
expires_in: self.class.access_token_expires_in(Doorkeeper.config, context),
|
@@ -28,8 +28,9 @@ module Doorkeeper
|
|
28
28
|
|
29
29
|
def find_or_create_access_token(client, resource_owner, scopes, server)
|
30
30
|
context = Authorization::Token.build_context(client, grant_type, scopes, resource_owner)
|
31
|
+
application = client.is_a?(Doorkeeper::Application) ? client : client.application if client
|
31
32
|
@access_token = server_config.access_token_model.find_or_create_for(
|
32
|
-
application:
|
33
|
+
application: application,
|
33
34
|
resource_owner: resource_owner,
|
34
35
|
scopes: scopes,
|
35
36
|
expires_in: Authorization::Token.access_token_expires_in(server, context),
|
@@ -13,8 +13,9 @@ module Doorkeeper
|
|
13
13
|
end
|
14
14
|
|
15
15
|
with_revocation(existing_token: existing_token) do
|
16
|
+
application = client.is_a?(Doorkeeper::Application) ? client : client.application if client
|
16
17
|
server_config.access_token_model.create_for(
|
17
|
-
application:
|
18
|
+
application: application,
|
18
19
|
resource_owner: nil,
|
19
20
|
scopes: scopes,
|
20
21
|
**attributes,
|
@@ -53,8 +53,8 @@ module Doorkeeper
|
|
53
53
|
as: mapping[:as],
|
54
54
|
controller: mapping[:controllers],
|
55
55
|
) do
|
56
|
-
routes.get
|
57
|
-
routes.get
|
56
|
+
routes.get native_authorization_code_route, action: :show, on: :member
|
57
|
+
routes.get '/', action: :new, on: :member
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -96,6 +96,10 @@ module Doorkeeper
|
|
96
96
|
only: %i[index destroy],
|
97
97
|
controller: mapping[:controllers]
|
98
98
|
end
|
99
|
+
|
100
|
+
def native_authorization_code_route
|
101
|
+
Doorkeeper.configuration.native_authorization_code_route
|
102
|
+
end
|
99
103
|
end
|
100
104
|
end
|
101
105
|
end
|
data/lib/doorkeeper/version.rb
CHANGED
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.6.
|
4
|
+
version: 5.6.1
|
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: 2022-
|
14
|
+
date: 2022-11-28 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: railties
|