doorkeeper 5.4.0.rc2 → 5.5.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 +90 -10
- data/README.md +4 -4
- data/app/controllers/doorkeeper/application_controller.rb +1 -0
- data/app/controllers/doorkeeper/authorizations_controller.rb +16 -5
- data/app/controllers/doorkeeper/authorized_applications_controller.rb +1 -1
- data/app/controllers/doorkeeper/token_info_controller.rb +12 -2
- data/app/controllers/doorkeeper/tokens_controller.rb +34 -26
- data/app/views/doorkeeper/applications/show.html.erb +16 -12
- data/app/views/doorkeeper/authorizations/form_post.html.erb +11 -0
- data/config/locales/en.yml +3 -1
- data/lib/doorkeeper.rb +5 -0
- data/lib/doorkeeper/config.rb +91 -62
- data/lib/doorkeeper/config/option.rb +1 -3
- data/lib/doorkeeper/config/validations.rb +53 -0
- data/lib/doorkeeper/engine.rb +1 -1
- data/lib/doorkeeper/grant_flow.rb +45 -0
- data/lib/doorkeeper/grant_flow/fallback_flow.rb +15 -0
- data/lib/doorkeeper/grant_flow/flow.rb +44 -0
- data/lib/doorkeeper/grant_flow/registry.rb +50 -0
- data/lib/doorkeeper/helpers/controller.rb +4 -0
- data/lib/doorkeeper/models/access_grant_mixin.rb +1 -2
- data/lib/doorkeeper/models/access_token_mixin.rb +4 -4
- data/lib/doorkeeper/models/concerns/revocable.rb +1 -1
- data/lib/doorkeeper/oauth/authorization/code.rb +5 -1
- data/lib/doorkeeper/oauth/authorization/context.rb +5 -5
- data/lib/doorkeeper/oauth/authorization/token.rb +11 -5
- data/lib/doorkeeper/oauth/authorization/uri_builder.rb +1 -1
- data/lib/doorkeeper/oauth/authorization_code_request.rb +10 -17
- data/lib/doorkeeper/oauth/base_request.rb +1 -1
- data/lib/doorkeeper/oauth/client_credentials/creator.rb +2 -1
- data/lib/doorkeeper/oauth/client_credentials/issuer.rb +1 -0
- data/lib/doorkeeper/oauth/code_request.rb +2 -2
- data/lib/doorkeeper/oauth/code_response.rb +17 -11
- data/lib/doorkeeper/oauth/error_response.rb +4 -3
- data/lib/doorkeeper/oauth/helpers/scope_checker.rb +1 -3
- data/lib/doorkeeper/oauth/password_access_token_request.rb +23 -3
- data/lib/doorkeeper/oauth/pre_authorization.rb +33 -8
- data/lib/doorkeeper/oauth/refresh_token_request.rb +13 -0
- data/lib/doorkeeper/oauth/token.rb +3 -3
- data/lib/doorkeeper/oauth/token_introspection.rb +1 -5
- data/lib/doorkeeper/oauth/token_request.rb +1 -1
- data/lib/doorkeeper/orm/active_record.rb +5 -14
- data/lib/doorkeeper/orm/active_record/mixins/access_grant.rb +11 -1
- data/lib/doorkeeper/orm/active_record/mixins/access_token.rb +9 -1
- data/lib/doorkeeper/orm/active_record/mixins/application.rb +26 -15
- data/lib/doorkeeper/orm/active_record/redirect_uri_validator.rb +5 -0
- data/lib/doorkeeper/rails/routes.rb +1 -3
- data/lib/doorkeeper/rake/db.rake +3 -3
- data/lib/doorkeeper/rake/setup.rake +5 -0
- data/lib/doorkeeper/request.rb +49 -12
- data/lib/doorkeeper/request/password.rb +1 -0
- data/lib/doorkeeper/server.rb +1 -1
- data/lib/doorkeeper/stale_records_cleaner.rb +4 -4
- data/lib/doorkeeper/version.rb +3 -7
- data/lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb.erb +1 -1
- data/lib/generators/doorkeeper/templates/initializer.rb +9 -7
- metadata +26 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08f9f8fec2b33300cb7ed4a09ff5682330698f51515404339a1ef40621f1d0d0'
|
4
|
+
data.tar.gz: 6d53afbc73dfdb731b0641575ffd7156ad3a74e11452654a99a1f24ad7f1093f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 345be4d8d397eacb61d21a749b0c8e1fe38a9f6f2868c14a76006a2cc0686c6e192b9828e7f37df39f83f80c69a4a8394191f9d28691db43616f47f52b2505bb
|
7
|
+
data.tar.gz: 4c96d9ad3d31305f1fb9fc135de3ee5a4e187a38f317307da6d83fc8dabe265dab741c52f25d7f907930a195918b1713aa3db6495b37626a2cfe5fe621f9e240
|
data/CHANGELOG.md
CHANGED
@@ -5,15 +5,73 @@ upgrade guides.
|
|
5
5
|
|
6
6
|
User-visible changes worth mentioning.
|
7
7
|
|
8
|
-
##
|
8
|
+
## main
|
9
9
|
|
10
|
-
- [#PR ID]
|
10
|
+
- [#PR ID] Add your PR description here.
|
11
|
+
|
12
|
+
## 5.5.1
|
13
|
+
|
14
|
+
- [#1496] Revoke `old_refresh_token` if `previous_refresh_token` is present.
|
15
|
+
- [#1495] Fix `respond_to` undefined in API-only mode
|
16
|
+
- [#1488] Verify client authentication for Resource Owner Password Grant when
|
17
|
+
`config.skip_client_authentication_for_password_grant` is set and the client credentials
|
18
|
+
are sent in a HTTP Basic auth header.
|
19
|
+
|
20
|
+
## 5.5.0
|
21
|
+
|
22
|
+
- [#1482] Simplify `TokenInfoController` to be overridable (extract response rendering).
|
23
|
+
- [#1478] Fix ownership association and Rake tasks when custom models configured.
|
24
|
+
- [#1477] Respect `ActiveRecord::Base.pluralize_table_names` for Doorkeeper table names.
|
25
|
+
|
26
|
+
## 5.5.0.rc2
|
27
|
+
|
28
|
+
- [#1473] Enable `Applications` and `AuthorizedApplications` controllers in API mode.
|
29
|
+
|
30
|
+
**[IMPORTANT]** you can still skip these controllers using `skip_controllers` in
|
31
|
+
`use_doorkeeper` inside `routes.rb`. Please do it in case you don't need them.
|
32
|
+
|
33
|
+
- [#1472] Fix `establish_connection` configuration for custom defined models.
|
34
|
+
- [#1471] Add support for Ruby 3.0.
|
35
|
+
- [#1469] Check if `redirect_uri` exists.
|
36
|
+
- [#1465] Memoize nil doorkeeper_token.
|
37
|
+
- [#1459] Use built-in Ruby option to remove padding in PKCE code challenge value.
|
38
|
+
- [#1457] Make owner_id a bigint for newly-generated owner migrations
|
39
|
+
- [#1452] Empty previous_refresh_token only if present.
|
40
|
+
- [#1440] Validate empty host in redirect_uri.
|
41
|
+
- [#1438] Add form post response mode.
|
42
|
+
- [#1458] Make `config.skip_client_authentication_for_password_grant` a long term configuration option.
|
43
|
+
|
44
|
+
## 5.5.0.rc1
|
45
|
+
|
46
|
+
- [#1435] Make error response not redirectable when client is unauthorized
|
47
|
+
- [#1426] Ensure ActiveRecord callbacks are executed on token revocation.
|
48
|
+
- [#1407] Remove redundant and complex to support helpers froms tests (`should_have_json`, etc).
|
49
|
+
- [#1416] Don't add introspection route if token introspection completely disabled.
|
50
|
+
- [#1410] Properly memoize `current_resource_owner` value (consider `nil` and `false` values).
|
51
|
+
- [#1415] Ignore PKCE params for non-PKCE grants.
|
52
|
+
- [#1418] Add ability to register custom OAuth Grant Flows.
|
53
|
+
- [#1420] Require client authentication for Resource Owner Password Grant as stated in OAuth RFC.
|
54
|
+
|
55
|
+
**[IMPORTANT]** you need to create a new OAuth client (`Doorkeeper::Application`) if you didn't
|
56
|
+
have it before and use client credentials in HTTP Basic auth if you previously used this grant
|
57
|
+
flow without client authentication. To opt out of this you could set the
|
58
|
+
`skip_client_authentication_for_password_grant` configuration option to `true`, but note that
|
59
|
+
this is in violation of the OAuth spec and represents a security risk.
|
60
|
+
All the users of your provider application now need to include client credentials when they use
|
61
|
+
this grant flow.
|
62
|
+
|
63
|
+
- [#1421] Add Resource Owner instance to authorization hook context for `custom_access_token_expires_in`
|
64
|
+
configuration option to allow resource owner based Access Tokens TTL.
|
65
|
+
|
66
|
+
## 5.4.0
|
67
|
+
|
68
|
+
- [#1404] Make `Doorkeeper::Application#read_attribute_for_serialization` public.
|
11
69
|
|
12
70
|
## 5.4.0.rc2
|
13
71
|
|
14
72
|
- [#1371] Add `#as_json` method and attributes serialization restriction for Application model.
|
15
73
|
Fixes information disclosure vulnerability (CVE-2020-10187).
|
16
|
-
|
74
|
+
|
17
75
|
**[IMPORTANT]** you need to re-implement `#as_json` method for Doorkeeper Application model
|
18
76
|
if you previously used `#to_json` serialization with custom options or attributes or rely on
|
19
77
|
JSON response from /oauth/applications.json or /oauth/authorized_applications.json. This change
|
@@ -27,17 +85,17 @@ User-visible changes worth mentioning.
|
|
27
85
|
- [#1402] Handle trying authorization with client credentials.
|
28
86
|
|
29
87
|
## 5.4.0.rc1
|
30
|
-
- [#1366] Sets expiry of token generated using `refresh_token` to that of original token. (Fixes #1364)
|
88
|
+
- [#1366] Sets expiry of token generated using `refresh_token` to that of original token. (Fixes #1364)
|
31
89
|
- [#1354] Add `authorize_resource_owner_for_client` option to authorize the calling user to access an application.
|
32
90
|
- [#1355] Allow to enable polymorphic Resource Owner association for Access Token & Grant
|
33
91
|
models (`use_polymorphic_resource_owner` configuration option).
|
34
|
-
|
92
|
+
|
35
93
|
**[IMPORTANT]** Review your custom patches or extensions for Doorkeeper internals if you
|
36
94
|
have such - since now Doorkeeper passes Resource Owner instance to every objects and not
|
37
95
|
just it's ID. See PR description for details.
|
38
|
-
|
96
|
+
|
39
97
|
- [#1356] Remove duplicated scopes from Access Tokens and Grants on attribute assignment.
|
40
|
-
- [#1357] Fix `Doorkeeper::OAuth::PreAuthorization#as_json` method causing
|
98
|
+
- [#1357] Fix `Doorkeeper::OAuth::PreAuthorization#as_json` method causing
|
41
99
|
`Stack level too deep` error with AMS (fix #1312).
|
42
100
|
- [#1358] Deprecate `active_record_options` configuration option.
|
43
101
|
- [#1359] Refactor Doorkeeper configuration options DSL to make it easy to reuse it
|
@@ -49,7 +107,7 @@ User-visible changes worth mentioning.
|
|
49
107
|
**[IMPORTANT]** now fully according to RFC 7009 nobody can do a revocation request without `client_id`
|
50
108
|
(for public clients) and `client_secret` (for private clients). Please update your apps to include that
|
51
109
|
info in the revocation request payload.
|
52
|
-
|
110
|
+
|
53
111
|
- [#1373] Make Doorkeeper routes mapper reusable in extensions.
|
54
112
|
- [#1374] Revoke and issue client credentials token in a transaction with a row lock.
|
55
113
|
- [#1384] Add context object with auth/pre_auth and issued_token for authorization hooks.
|
@@ -58,6 +116,10 @@ User-visible changes worth mentioning.
|
|
58
116
|
- [#1393] Improve Applications #show page with more informative data on client secret and scopes.
|
59
117
|
- [#1394] Use Ruby `autoload` feature to load Doorkeeper files.
|
60
118
|
|
119
|
+
## 5.3.3
|
120
|
+
|
121
|
+
- [#1404] Backport: Make `Doorkeeper::Application#read_attribute_for_serialization` public.
|
122
|
+
|
61
123
|
## 5.3.2
|
62
124
|
|
63
125
|
- [#1371] Backport: add `#as_json` method and attributes serialization restriction for Application model.
|
@@ -82,13 +144,17 @@ User-visible changes worth mentioning.
|
|
82
144
|
requested a new access token, reenable it with `revoke_previous_client_credentials_token` in Doorkeeper
|
83
145
|
initialization file.
|
84
146
|
|
147
|
+
## 5.2.6
|
148
|
+
|
149
|
+
- [#1404] Backport: Make `Doorkeeper::Application#read_attribute_for_serialization` public.
|
150
|
+
|
85
151
|
## 5.2.5
|
86
152
|
|
87
153
|
- [#1371] Backport: add `#as_json` method and attributes serialization restriction for Application model.
|
88
154
|
Fixes information disclosure vulnerability (CVE-2020-10187).
|
89
|
-
|
155
|
+
|
90
156
|
## 5.2.4
|
91
|
-
|
157
|
+
|
92
158
|
- [#1360] Backport: Increase `matching_token_for` batch lookup size to 10 000 and make it configurable.
|
93
159
|
|
94
160
|
## 5.2.3
|
@@ -154,6 +220,15 @@ User-visible changes worth mentioning.
|
|
154
220
|
- [#1248] Return the unhashed Application Secret in the JSON response after creating new application even when `hash_application_secrets` is used.
|
155
221
|
- [#1238] Better support for native app with support for custom scheme and localhost redirection.
|
156
222
|
|
223
|
+
## 5.1.2
|
224
|
+
|
225
|
+
- [#1404] Backport: Make `Doorkeeper::Application#read_attribute_for_serialization` public.
|
226
|
+
|
227
|
+
## 5.1.1
|
228
|
+
|
229
|
+
- [#1371] Backport: add `#as_json` method and attributes serialization restriction for Application model.
|
230
|
+
Fixes information disclosure vulnerability (CVE-2020-10187).
|
231
|
+
|
157
232
|
## 5.1.0
|
158
233
|
|
159
234
|
- [#1243] Add nil check operator in token checking at token introspection.
|
@@ -215,6 +290,11 @@ User-visible changes worth mentioning.
|
|
215
290
|
- [#1164] Fix error when `root_path` is not defined.
|
216
291
|
- [#1162] Fix `enforce_content_type` for requests without body.
|
217
292
|
|
293
|
+
## 5.0.3
|
294
|
+
|
295
|
+
- [#1371] Backport: add `#as_json` method and attributes serialization restriction for Application model.
|
296
|
+
Fixes information disclosure vulnerability (CVE-2020-10187).
|
297
|
+
|
218
298
|
## 5.0.2
|
219
299
|
|
220
300
|
- [#1158] Fix initializer template: change `handle_auth_errors` option
|
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=
|
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=
|
7
|
-
[![Security](https://hakiri.io/github/doorkeeper-gem/doorkeeper/
|
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 `
|
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,6 +4,7 @@ module Doorkeeper
|
|
4
4
|
class ApplicationController <
|
5
5
|
Doorkeeper.config.resolve_controller(:base)
|
6
6
|
include Helpers::Controller
|
7
|
+
include ActionController::MimeResponds if Doorkeeper.config.api_only
|
7
8
|
|
8
9
|
unless Doorkeeper.config.api_only
|
9
10
|
protect_from_forgery with: :exception
|
@@ -52,10 +52,19 @@ module Doorkeeper
|
|
52
52
|
def redirect_or_render(auth)
|
53
53
|
if auth.redirectable?
|
54
54
|
if Doorkeeper.configuration.api_only
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
if pre_auth.form_post_response?
|
56
|
+
render(
|
57
|
+
json: { status: :post, redirect_uri: pre_auth.redirect_uri, body: auth.body },
|
58
|
+
status: auth.status,
|
59
|
+
)
|
60
|
+
else
|
61
|
+
render(
|
62
|
+
json: { status: :redirect, redirect_uri: auth.redirect_uri },
|
63
|
+
status: auth.status,
|
64
|
+
)
|
65
|
+
end
|
66
|
+
elsif pre_auth.form_post_response?
|
67
|
+
render :form_post
|
59
68
|
else
|
60
69
|
redirect_to auth.redirect_uri
|
61
70
|
end
|
@@ -82,8 +91,10 @@ module Doorkeeper
|
|
82
91
|
code_challenge
|
83
92
|
code_challenge_method
|
84
93
|
response_type
|
94
|
+
response_mode
|
85
95
|
redirect_uri
|
86
|
-
scope
|
96
|
+
scope
|
97
|
+
state
|
87
98
|
]
|
88
99
|
end
|
89
100
|
|
@@ -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:
|
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
|
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
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Doorkeeper
|
4
4
|
class TokensController < Doorkeeper::ApplicationMetalController
|
5
|
+
before_action :validate_presence_of_client, only: [:revoke]
|
6
|
+
|
5
7
|
def create
|
6
8
|
headers.merge!(authorize_response.headers)
|
7
9
|
render json: authorize_response.body,
|
@@ -12,32 +14,6 @@ module Doorkeeper
|
|
12
14
|
|
13
15
|
# OAuth 2.0 Token Revocation - http://tools.ietf.org/html/rfc7009
|
14
16
|
def revoke
|
15
|
-
# @see 2.1. Revocation Request
|
16
|
-
#
|
17
|
-
# The client constructs the request by including the following
|
18
|
-
# parameters using the "application/x-www-form-urlencoded" format in
|
19
|
-
# the HTTP request entity-body:
|
20
|
-
# token REQUIRED.
|
21
|
-
# token_type_hint OPTIONAL.
|
22
|
-
#
|
23
|
-
# The client also includes its authentication credentials as described
|
24
|
-
# in Section 2.3. of [RFC6749].
|
25
|
-
#
|
26
|
-
# The authorization server first validates the client credentials (in
|
27
|
-
# case of a confidential client) and then verifies whether the token
|
28
|
-
# was issued to the client making the revocation request.
|
29
|
-
unless server.client
|
30
|
-
# If this validation [client credentials / token ownership] fails, the request is
|
31
|
-
# refused and the client is informed of the error by the authorization server as
|
32
|
-
# described below.
|
33
|
-
#
|
34
|
-
# @see 2.2.1. Error Response
|
35
|
-
#
|
36
|
-
# The error presentation conforms to the definition in Section 5.2 of [RFC6749].
|
37
|
-
render json: revocation_error_response, status: :forbidden
|
38
|
-
return
|
39
|
-
end
|
40
|
-
|
41
17
|
# The authorization server responds with HTTP status code 200 if the client
|
42
18
|
# submitted an invalid token or the token has been revoked successfully.
|
43
19
|
if token.blank?
|
@@ -68,7 +44,39 @@ module Doorkeeper
|
|
68
44
|
|
69
45
|
private
|
70
46
|
|
47
|
+
def validate_presence_of_client
|
48
|
+
return if Doorkeeper.config.skip_client_authentication_for_password_grant
|
49
|
+
|
50
|
+
# @see 2.1. Revocation Request
|
51
|
+
#
|
52
|
+
# The client constructs the request by including the following
|
53
|
+
# parameters using the "application/x-www-form-urlencoded" format in
|
54
|
+
# the HTTP request entity-body:
|
55
|
+
# token REQUIRED.
|
56
|
+
# token_type_hint OPTIONAL.
|
57
|
+
#
|
58
|
+
# The client also includes its authentication credentials as described
|
59
|
+
# in Section 2.3. of [RFC6749].
|
60
|
+
#
|
61
|
+
# The authorization server first validates the client credentials (in
|
62
|
+
# case of a confidential client) and then verifies whether the token
|
63
|
+
# was issued to the client making the revocation request.
|
64
|
+
return if server.client
|
65
|
+
|
66
|
+
# If this validation [client credentials / token ownership] fails, the request is
|
67
|
+
# refused and the client is informed of the error by the authorization server as
|
68
|
+
# described below.
|
69
|
+
#
|
70
|
+
# @see 2.2.1. Error Response
|
71
|
+
#
|
72
|
+
# The error presentation conforms to the definition in Section 5.2 of [RFC6749].
|
73
|
+
render json: revocation_error_response, status: :forbidden
|
74
|
+
end
|
75
|
+
|
71
76
|
# OAuth 2.0 Section 2.1 defines two client types, "public" & "confidential".
|
77
|
+
#
|
78
|
+
# RFC7009
|
79
|
+
# Section 5. Security Considerations
|
72
80
|
# A malicious client may attempt to guess valid tokens on this endpoint
|
73
81
|
# by making revocation requests against potential token strings.
|
74
82
|
# According to this specification, a client's request must contain a
|
@@ -35,18 +35,22 @@
|
|
35
35
|
|
36
36
|
<h4><%= t('.callback_urls') %>:</h4>
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
<
|
42
|
-
<
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
38
|
+
<% if @application.redirect_uri.present? %>
|
39
|
+
<table>
|
40
|
+
<% @application.redirect_uri.split.each do |uri| %>
|
41
|
+
<tr>
|
42
|
+
<td>
|
43
|
+
<code class="bg-light"><%= uri %></code>
|
44
|
+
</td>
|
45
|
+
<td>
|
46
|
+
<%= link_to t('doorkeeper.applications.buttons.authorize'), oauth_authorization_path(client_id: @application.uid, redirect_uri: uri, response_type: 'code', scope: @application.scopes), class: 'btn btn-success', target: '_blank' %>
|
47
|
+
</td>
|
48
|
+
</tr>
|
49
|
+
<% end %>
|
50
|
+
</table>
|
51
|
+
<% else %>
|
52
|
+
<span class="bg-light font-italic text-uppercase text-muted"><%= t('.not_defined') %></span>
|
53
|
+
<% end %>
|
50
54
|
</div>
|
51
55
|
|
52
56
|
<div class="col-md-4">
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<header class="page-header">
|
2
|
+
<h1><%= t('.title') %></h1>
|
3
|
+
</header>
|
4
|
+
|
5
|
+
<main role="main" onload="document.forms[0].submit()">
|
6
|
+
<%= form_tag @pre_auth.redirect_uri, method: :post do %>
|
7
|
+
<% @authorize_response.body.each do |key, value| %>
|
8
|
+
<%= hidden_field_tag key, value %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
</main>
|
data/config/locales/en.yml
CHANGED
@@ -72,6 +72,8 @@ en:
|
|
72
72
|
able_to: 'This application will be able to'
|
73
73
|
show:
|
74
74
|
title: 'Authorization code'
|
75
|
+
form_post:
|
76
|
+
title: 'Submit this form'
|
75
77
|
|
76
78
|
authorized_applications:
|
77
79
|
confirmations:
|
@@ -93,7 +95,6 @@ en:
|
|
93
95
|
invalid_request:
|
94
96
|
unknown: 'The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.'
|
95
97
|
missing_param: 'Missing required parameter: %{value}.'
|
96
|
-
not_support_pkce: 'Invalid code_verifier parameter. Server does not support pkce.'
|
97
98
|
request_not_authorized: 'Request need to be authorized. Required parameter for authorizing request is missing or invalid.'
|
98
99
|
invalid_redirect_uri: "The requested redirect uri is malformed or doesn't match client redirect URI."
|
99
100
|
unauthorized_client: 'The client is not authorized to perform this request using this method.'
|
@@ -110,6 +111,7 @@ en:
|
|
110
111
|
|
111
112
|
# Access grant errors
|
112
113
|
unsupported_response_type: 'The authorization server does not support this response type.'
|
114
|
+
unsupported_response_mode: 'The authorization server does not support this response mode.'
|
113
115
|
|
114
116
|
# Access token errors
|
115
117
|
invalid_client: 'Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method.'
|
data/lib/doorkeeper.rb
CHANGED
@@ -7,6 +7,7 @@ require "doorkeeper/engine"
|
|
7
7
|
#
|
8
8
|
module Doorkeeper
|
9
9
|
autoload :Errors, "doorkeeper/errors"
|
10
|
+
autoload :GrantFlow, "doorkeeper/grant_flow"
|
10
11
|
autoload :OAuth, "doorkeeper/oauth"
|
11
12
|
autoload :Rake, "doorkeeper/rake"
|
12
13
|
autoload :Request, "doorkeeper/request"
|
@@ -114,4 +115,8 @@ module Doorkeeper
|
|
114
115
|
def self.authenticate(request, methods = Doorkeeper.config.access_token_methods)
|
115
116
|
OAuth::Token.authenticate(request, *methods)
|
116
117
|
end
|
118
|
+
|
119
|
+
def self.gem_version
|
120
|
+
::Gem::Version.new(::Doorkeeper::VERSION::STRING)
|
121
|
+
end
|
117
122
|
end
|