doorkeeper 5.8.1 → 5.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/app/controllers/doorkeeper/tokens_controller.rb +4 -2
- data/config/locales/en.yml +1 -0
- data/lib/doorkeeper/errors.rb +0 -1
- data/lib/doorkeeper/oauth/authorization_code_request.rb +1 -5
- data/lib/doorkeeper/oauth/pre_authorization.rb +7 -3
- data/lib/doorkeeper/rails/helpers.rb +3 -1
- 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: de574cec8c17af2fd1026081acc0bf592c71ecbf947d92546df6b4d48ce3b5ce
|
4
|
+
data.tar.gz: eb282ce352bbd4491014b753535ff24e804ca801e02aef8a6ded3f7ca5951e64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68b668d79eb5532cb4dbe660eb26269d67eb545b5dbd12bae15c087752c7e5447e1f60326725c0d838189a746de5718e8644605dcdd946d4f2cf29a556297369
|
7
|
+
data.tar.gz: 8ad2d79f707129abd0787710cc86ee563af9887f986dec03edc396c691ffb26e18279b3693bc15658d059e78dd7dc2ce3093a137c03bb16e7858832d9e80c368
|
data/CHANGELOG.md
CHANGED
@@ -9,6 +9,13 @@ User-visible changes worth mentioning.
|
|
9
9
|
|
10
10
|
Add your entry here.
|
11
11
|
|
12
|
+
## 5.8.2
|
13
|
+
|
14
|
+
- [#1755] Fix the error message for force_pkce
|
15
|
+
- [#1761] Memoize authentication failure
|
16
|
+
- [#1762] Allow missing client to trigger invalid client error when force_pkce is enabled
|
17
|
+
- [#1767] Make sure error handling happens on a controller level opposed to action level to account for the controller being extended
|
18
|
+
|
12
19
|
## 5.8.1
|
13
20
|
|
14
21
|
- [#1752] Bump the range of supported Ruby and Rails versions
|
@@ -4,12 +4,14 @@ module Doorkeeper
|
|
4
4
|
class TokensController < Doorkeeper::ApplicationMetalController
|
5
5
|
before_action :validate_presence_of_client, only: [:revoke]
|
6
6
|
|
7
|
+
rescue_from Errors::DoorkeeperError do |e|
|
8
|
+
handle_token_exception(e)
|
9
|
+
end
|
10
|
+
|
7
11
|
def create
|
8
12
|
headers.merge!(authorize_response.headers)
|
9
13
|
render json: authorize_response.body,
|
10
14
|
status: authorize_response.status
|
11
|
-
rescue Errors::DoorkeeperError => e
|
12
|
-
handle_token_exception(e)
|
13
15
|
end
|
14
16
|
|
15
17
|
# OAuth 2.0 Token Revocation - https://datatracker.ietf.org/doc/html/rfc7009
|
data/config/locales/en.yml
CHANGED
@@ -96,6 +96,7 @@ en:
|
|
96
96
|
unknown: 'The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.'
|
97
97
|
missing_param: 'Missing required parameter: %{value}.'
|
98
98
|
request_not_authorized: 'Request need to be authorized. Required parameter for authorizing request is missing or invalid.'
|
99
|
+
invalid_code_challenge: 'Code challenge is required.'
|
99
100
|
invalid_redirect_uri: "The requested redirect uri is malformed or doesn't match client redirect URI."
|
100
101
|
unauthorized_client: 'The client is not authorized to perform this request using this method.'
|
101
102
|
access_denied: 'The resource owner or authorization server denied the request.'
|
data/lib/doorkeeper/errors.rb
CHANGED
@@ -68,7 +68,6 @@ module Doorkeeper
|
|
68
68
|
InvalidClient = Class.new(BaseResponseError)
|
69
69
|
InvalidScope = Class.new(BaseResponseError)
|
70
70
|
InvalidRedirectUri = Class.new(BaseResponseError)
|
71
|
-
InvalidCodeChallenge = Class.new(BaseResponseError)
|
72
71
|
InvalidGrant = Class.new(BaseResponseError)
|
73
72
|
|
74
73
|
UnauthorizedClient = Class.new(BaseResponseError)
|
@@ -59,15 +59,11 @@ module Doorkeeper
|
|
59
59
|
Doorkeeper.config.access_grant_model.pkce_supported?
|
60
60
|
end
|
61
61
|
|
62
|
-
def confidential?
|
63
|
-
client&.confidential
|
64
|
-
end
|
65
|
-
|
66
62
|
def validate_params
|
67
63
|
@missing_param =
|
68
64
|
if grant&.uses_pkce? && code_verifier.blank?
|
69
65
|
:code_verifier
|
70
|
-
elsif !confidential
|
66
|
+
elsif client && !client.confidential && Doorkeeper.config.force_pkce? && code_verifier.blank?
|
71
67
|
:code_verifier
|
72
68
|
elsif redirect_uri.blank?
|
73
69
|
:redirect_uri
|
@@ -14,12 +14,13 @@ module Doorkeeper
|
|
14
14
|
validate :response_type, error: Errors::UnsupportedResponseType
|
15
15
|
validate :response_mode, error: Errors::UnsupportedResponseMode
|
16
16
|
validate :scopes, error: Errors::InvalidScope
|
17
|
-
validate :code_challenge, error: Errors::
|
17
|
+
validate :code_challenge, error: Errors::InvalidRequest
|
18
18
|
validate :code_challenge_method, error: Errors::InvalidCodeChallengeMethod
|
19
19
|
|
20
20
|
attr_reader :client, :code_challenge, :code_challenge_method, :missing_param,
|
21
21
|
:redirect_uri, :resource_owner, :response_type, :state,
|
22
|
-
:authorization_response_flow, :response_mode, :custom_access_token_attributes
|
22
|
+
:authorization_response_flow, :response_mode, :custom_access_token_attributes,
|
23
|
+
:invalid_request_reason
|
23
24
|
|
24
25
|
def initialize(server, parameters = {}, resource_owner = nil)
|
25
26
|
@server = server
|
@@ -147,7 +148,10 @@ module Doorkeeper
|
|
147
148
|
def validate_code_challenge
|
148
149
|
return true unless Doorkeeper.config.force_pkce?
|
149
150
|
return true if client.confidential
|
150
|
-
code_challenge.present?
|
151
|
+
return true if code_challenge.present?
|
152
|
+
|
153
|
+
@invalid_request_reason = :invalid_code_challenge
|
154
|
+
false
|
151
155
|
end
|
152
156
|
|
153
157
|
def validate_code_challenge_method
|
@@ -70,7 +70,9 @@ module Doorkeeper
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def doorkeeper_token
|
73
|
-
@doorkeeper_token
|
73
|
+
return @doorkeeper_token if defined?(@doorkeeper_token)
|
74
|
+
|
75
|
+
@doorkeeper_token = OAuth::Token.authenticate(
|
74
76
|
request,
|
75
77
|
*Doorkeeper.config.access_token_methods,
|
76
78
|
)
|
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.8.
|
4
|
+
version: 5.8.2
|
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:
|
14
|
+
date: 2025-04-04 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: railties
|