doorkeeper 5.1.0 → 5.3.0
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/Appraisals +3 -3
- data/CHANGELOG.md +881 -0
- data/CONTRIBUTING.md +11 -9
- data/Dangerfile +2 -2
- data/Dockerfile +29 -0
- data/Gemfile +4 -3
- data/NEWS.md +1 -814
- data/README.md +11 -3
- data/RELEASING.md +6 -5
- data/app/controllers/doorkeeper/application_controller.rb +2 -2
- data/app/controllers/doorkeeper/application_metal_controller.rb +3 -2
- data/app/controllers/doorkeeper/applications_controller.rb +1 -0
- data/app/controllers/doorkeeper/authorizations_controller.rb +16 -9
- data/app/controllers/doorkeeper/authorized_applications_controller.rb +2 -2
- data/app/controllers/doorkeeper/tokens_controller.rb +32 -9
- data/app/views/doorkeeper/applications/_form.html.erb +0 -6
- data/app/views/doorkeeper/applications/show.html.erb +1 -1
- data/config/locales/en.yml +8 -2
- data/doorkeeper.gemspec +9 -1
- data/gemfiles/rails_5_0.gemfile +3 -2
- data/gemfiles/rails_5_1.gemfile +3 -2
- data/gemfiles/rails_5_2.gemfile +3 -2
- data/gemfiles/rails_6_0.gemfile +4 -3
- data/gemfiles/rails_master.gemfile +3 -2
- data/lib/doorkeeper/config/option.rb +13 -7
- data/lib/doorkeeper/config.rb +157 -42
- data/lib/doorkeeper/errors.rb +13 -18
- data/lib/doorkeeper/grape/helpers.rb +6 -2
- data/lib/doorkeeper/helpers/controller.rb +28 -7
- data/lib/doorkeeper/models/access_grant_mixin.rb +7 -6
- data/lib/doorkeeper/models/access_token_mixin.rb +99 -20
- 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 +12 -14
- data/lib/doorkeeper/oauth/authorization/token.rb +10 -7
- data/lib/doorkeeper/oauth/authorization_code_request.rb +31 -15
- data/lib/doorkeeper/oauth/base_request.rb +10 -4
- data/lib/doorkeeper/oauth/client.rb +7 -8
- data/lib/doorkeeper/oauth/client_credentials/creator.rb +23 -2
- data/lib/doorkeeper/oauth/client_credentials/issuer.rb +7 -7
- data/lib/doorkeeper/oauth/client_credentials/{validation.rb → validator.rb} +10 -2
- data/lib/doorkeeper/oauth/client_credentials_request.rb +1 -1
- data/lib/doorkeeper/oauth/code_request.rb +5 -11
- data/lib/doorkeeper/oauth/code_response.rb +4 -4
- data/lib/doorkeeper/oauth/error.rb +1 -1
- data/lib/doorkeeper/oauth/error_response.rb +6 -6
- 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 +19 -5
- data/lib/doorkeeper/oauth/invalid_request_response.rb +43 -0
- data/lib/doorkeeper/oauth/invalid_token_response.rb +5 -2
- data/lib/doorkeeper/oauth/nonstandard.rb +39 -0
- data/lib/doorkeeper/oauth/password_access_token_request.rb +9 -4
- data/lib/doorkeeper/oauth/pre_authorization.rb +76 -38
- data/lib/doorkeeper/oauth/refresh_token_request.rb +17 -14
- data/lib/doorkeeper/oauth/token.rb +2 -2
- data/lib/doorkeeper/oauth/token_introspection.rb +26 -16
- data/lib/doorkeeper/oauth/token_request.rb +4 -18
- 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 +5 -83
- 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 +61 -0
- data/lib/doorkeeper/orm/active_record.rb +21 -6
- 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/authorization_code.rb +5 -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/request.rb +7 -12
- data/lib/doorkeeper/server.rb +3 -7
- data/lib/doorkeeper/stale_records_cleaner.rb +6 -2
- data/lib/doorkeeper/version.rb +1 -1
- data/lib/doorkeeper.rb +6 -3
- 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 +7 -7
- data/lib/generators/doorkeeper/templates/initializer.rb +149 -33
- data/lib/generators/doorkeeper/templates/migration.rb.erb +4 -1
- data/spec/controllers/application_metal_controller_spec.rb +1 -1
- data/spec/controllers/applications_controller_spec.rb +95 -1
- data/spec/controllers/authorizations_controller_spec.rb +156 -75
- data/spec/controllers/protected_resources_controller_spec.rb +28 -20
- data/spec/controllers/token_info_controller_spec.rb +1 -1
- data/spec/controllers/tokens_controller_spec.rb +206 -38
- data/spec/dummy/config/application.rb +3 -1
- data/spec/dummy/config/initializers/doorkeeper.rb +54 -9
- 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 +104 -7
- 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 +129 -115
- data/spec/lib/oauth/base_request_spec.rb +154 -135
- 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 +43 -3
- 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 -35
- 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/helpers/uri_checker_spec.rb +17 -2
- data/spec/lib/oauth/invalid_request_response_spec.rb +73 -0
- 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 +161 -153
- data/spec/lib/oauth/refresh_token_request_spec.rb +138 -138
- data/spec/lib/oauth/scopes_spec.rb +104 -106
- data/spec/lib/oauth/token_request_spec.rb +117 -110
- data/spec/lib/oauth/token_response_spec.rb +71 -73
- data/spec/lib/oauth/token_spec.rb +121 -123
- data/spec/lib/server_spec.rb +0 -12
- data/spec/models/doorkeeper/access_grant_spec.rb +21 -4
- data/spec/models/doorkeeper/access_token_spec.rb +42 -11
- data/spec/models/doorkeeper/application_spec.rb +114 -77
- data/spec/requests/applications/applications_request_spec.rb +1 -1
- data/spec/requests/endpoints/authorization_spec.rb +26 -8
- data/spec/requests/endpoints/token_spec.rb +1 -1
- data/spec/requests/flows/authorization_code_errors_spec.rb +1 -0
- data/spec/requests/flows/authorization_code_spec.rb +123 -45
- data/spec/requests/flows/client_credentials_spec.rb +38 -0
- data/spec/requests/flows/implicit_grant_errors_spec.rb +22 -10
- data/spec/requests/flows/implicit_grant_spec.rb +9 -8
- data/spec/requests/flows/password_spec.rb +67 -10
- data/spec/requests/flows/refresh_token_spec.rb +20 -20
- data/spec/requests/flows/revoke_token_spec.rb +37 -23
- data/spec/spec_helper.rb +1 -4
- data/spec/support/doorkeeper_rspec.rb +1 -1
- data/spec/support/helpers/request_spec_helper.rb +14 -2
- data/spec/support/shared/controllers_shared_context.rb +33 -23
- data/spec/validators/redirect_uri_validator_spec.rb +41 -16
- metadata +19 -16
- data/.coveralls.yml +0 -1
- data/.github/ISSUE_TEMPLATE.md +0 -25
- data/.github/PULL_REQUEST_TEMPLATE.md +0 -17
- data/.gitignore +0 -20
- data/.gitlab-ci.yml +0 -16
- data/.hound.yml +0 -3
- data/.rspec +0 -1
- data/.rubocop.yml +0 -50
- data/.travis.yml +0 -35
- data/app/validators/redirect_uri_validator.rb +0 -50
- data/spec/support/http_method_shim.rb +0 -29
data/README.md
CHANGED
|
@@ -21,10 +21,11 @@ Supported features:
|
|
|
21
21
|
- [Implicit grant](http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-4.2)
|
|
22
22
|
- [Resource Owner Password Credentials](http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-4.3)
|
|
23
23
|
- [Client Credentials](http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-4.4)
|
|
24
|
-
- [Proof Key for Code Exchange](https://tools.ietf.org/html/rfc7636)
|
|
25
24
|
- [OAuth 2.0 Token Revocation](http://tools.ietf.org/html/rfc7009)
|
|
26
25
|
- [OAuth 2.0 Token Introspection](https://tools.ietf.org/html/rfc7662)
|
|
27
26
|
- [OAuth 2.0 Threat Model and Security Considerations](http://tools.ietf.org/html/rfc6819)
|
|
27
|
+
- [OAuth 2.0 for Native Apps](https://tools.ietf.org/html/draft-ietf-oauth-native-apps-10)
|
|
28
|
+
- [Proof Key for Code Exchange by OAuth Public Clients](https://tools.ietf.org/html/rfc7636)
|
|
28
29
|
|
|
29
30
|
## Table of Contents
|
|
30
31
|
|
|
@@ -93,6 +94,7 @@ Doorkeeper supports Active Record by default, but can be configured to work with
|
|
|
93
94
|
| MongoDB | [doorkeeper-gem/doorkeeper-mongodb](https://github.com/doorkeeper-gem/doorkeeper-mongodb) |
|
|
94
95
|
| Sequel | [nbulaj/doorkeeper-sequel](https://github.com/nbulaj/doorkeeper-sequel) |
|
|
95
96
|
| Couchbase | [acaprojects/doorkeeper-couchbase](https://github.com/acaprojects/doorkeeper-couchbase) |
|
|
97
|
+
| RethinkDB | [aca-labs/doorkeeper-rethinkdb](https://github.com/aca-labs/doorkeeper-rethinkdb) |
|
|
96
98
|
|
|
97
99
|
## Extensions
|
|
98
100
|
|
|
@@ -136,6 +138,12 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
|
|
136
138
|
|
|
137
139
|
> If you prefer not to deal with the gory details of OAuth 2, need dedicated customer support & consulting, try the cloud-based SaaS version: [https://oauth.io](https://oauth.io/?utm_source=doorkeeper-gem)
|
|
138
140
|
|
|
141
|
+
<br>
|
|
142
|
+
|
|
143
|
+
<a href="https://www.wealthsimple.com/?utm_source=doorkeeper-gem" target="_blank"><img src="https://wealthsimple.s3.amazonaws.com/branding/medium-black.svg"/></a>
|
|
144
|
+
|
|
145
|
+
> Wealthsimple is a financial company on a mission to help everyone achieve financial freedom by providing products and advice that are accessible and affordable. Using smart technology, Wealthsimple takes financial services that are often confusing, opaque and expensive and makes them simple, transparent, and low-cost. See what Investing on Autopilot is all about: [https://www.wealthsimple.com](https://www.wealthsimple.com/?utm_source=doorkeeper-gem)
|
|
146
|
+
|
|
139
147
|
## Development
|
|
140
148
|
|
|
141
149
|
To run the local engine server:
|
|
@@ -146,10 +154,10 @@ bundle exec rake doorkeeper:server
|
|
|
146
154
|
````
|
|
147
155
|
|
|
148
156
|
By default, it uses the latest Rails version with ActiveRecord. To run the
|
|
149
|
-
tests with a specific
|
|
157
|
+
tests with a specific Rails version:
|
|
150
158
|
|
|
151
159
|
```
|
|
152
|
-
|
|
160
|
+
BUNDLE_GEMFILE=gemfiles/rails_6_0.gemfile bundle exec rake
|
|
153
161
|
```
|
|
154
162
|
|
|
155
163
|
## Contributing
|
data/RELEASING.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
# Releasing
|
|
1
|
+
# Releasing Doorkeeper
|
|
2
2
|
|
|
3
|
-
How to release
|
|
3
|
+
How to release Doorkeeper in five easy steps!
|
|
4
4
|
|
|
5
5
|
1. Update `lib/doorkeeper/version.rb` file accordingly.
|
|
6
|
-
2. Update `
|
|
7
|
-
3. Commit changes: `git commit -am 'Bump to vVERSION'
|
|
8
|
-
4.
|
|
6
|
+
2. Update `CHANGELOG.md` to reflect the changes since last release.
|
|
7
|
+
3. Commit changes: `git commit -am 'Bump to vVERSION'`.
|
|
8
|
+
4. Build and publish the gem.
|
|
9
|
+
4. Create GitHub release.
|
|
9
10
|
5. Announce the new release, making sure to say “thank you” to the contributors
|
|
10
11
|
who helped shape this version!
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module Doorkeeper
|
|
4
4
|
class ApplicationController <
|
|
5
|
-
Doorkeeper.
|
|
5
|
+
Doorkeeper.config.resolve_controller(:base)
|
|
6
6
|
include Helpers::Controller
|
|
7
7
|
|
|
8
|
-
unless Doorkeeper.
|
|
8
|
+
unless Doorkeeper.config.api_only
|
|
9
9
|
protect_from_forgery with: :exception
|
|
10
10
|
helper "doorkeeper/dashboard"
|
|
11
11
|
end
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Doorkeeper
|
|
4
|
-
class ApplicationMetalController <
|
|
4
|
+
class ApplicationMetalController <
|
|
5
|
+
Doorkeeper.config.resolve_controller(:base_metal)
|
|
5
6
|
include Helpers::Controller
|
|
6
7
|
|
|
7
8
|
before_action :enforce_content_type,
|
|
8
|
-
if: -> { Doorkeeper.
|
|
9
|
+
if: -> { Doorkeeper.config.enforce_content_type }
|
|
9
10
|
|
|
10
11
|
ActiveSupport.run_load_hooks(:doorkeeper_metal_controller, self)
|
|
11
12
|
end
|
|
@@ -32,6 +32,7 @@ module Doorkeeper
|
|
|
32
32
|
|
|
33
33
|
if @application.save
|
|
34
34
|
flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])
|
|
35
|
+
flash[:application_secret] = @application.plaintext_secret
|
|
35
36
|
|
|
36
37
|
respond_to do |format|
|
|
37
38
|
format.html { redirect_to oauth_application_url(@application) }
|
|
@@ -12,7 +12,6 @@ module Doorkeeper
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
# TODO: Handle raise invalid authorization
|
|
16
15
|
def create
|
|
17
16
|
redirect_or_render authorize_response
|
|
18
17
|
end
|
|
@@ -46,7 +45,7 @@ module Doorkeeper
|
|
|
46
45
|
AccessToken.matching_token_for(
|
|
47
46
|
pre_auth.client,
|
|
48
47
|
current_resource_owner.id,
|
|
49
|
-
pre_auth.scopes
|
|
48
|
+
pre_auth.scopes,
|
|
50
49
|
)
|
|
51
50
|
end
|
|
52
51
|
|
|
@@ -55,7 +54,7 @@ module Doorkeeper
|
|
|
55
54
|
if Doorkeeper.configuration.api_only
|
|
56
55
|
render(
|
|
57
56
|
json: { status: :redirect, redirect_uri: auth.redirect_uri },
|
|
58
|
-
status: auth.status
|
|
57
|
+
status: auth.status,
|
|
59
58
|
)
|
|
60
59
|
else
|
|
61
60
|
redirect_to auth.redirect_uri
|
|
@@ -66,9 +65,16 @@ module Doorkeeper
|
|
|
66
65
|
end
|
|
67
66
|
|
|
68
67
|
def pre_auth
|
|
69
|
-
@pre_auth ||= OAuth::PreAuthorization.new(Doorkeeper.configuration,
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
@pre_auth ||= OAuth::PreAuthorization.new(Doorkeeper.configuration, pre_auth_params)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def pre_auth_params
|
|
72
|
+
params.slice(*pre_auth_param_fields).permit(*pre_auth_param_fields)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def pre_auth_param_fields
|
|
76
|
+
%i[client_id response_type redirect_uri scope state code_challenge
|
|
77
|
+
code_challenge_method]
|
|
72
78
|
end
|
|
73
79
|
|
|
74
80
|
def authorization
|
|
@@ -81,10 +87,11 @@ module Doorkeeper
|
|
|
81
87
|
|
|
82
88
|
def authorize_response
|
|
83
89
|
@authorize_response ||= begin
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
return pre_auth.error_response unless pre_auth.authorizable?
|
|
91
|
+
|
|
92
|
+
before_successful_authorization
|
|
86
93
|
auth = strategy.authorize
|
|
87
|
-
after_successful_authorization
|
|
94
|
+
after_successful_authorization
|
|
88
95
|
auth
|
|
89
96
|
end
|
|
90
97
|
end
|
|
@@ -16,13 +16,13 @@ module Doorkeeper
|
|
|
16
16
|
def destroy
|
|
17
17
|
Application.revoke_tokens_and_grants_for(
|
|
18
18
|
params[:id],
|
|
19
|
-
current_resource_owner
|
|
19
|
+
current_resource_owner,
|
|
20
20
|
)
|
|
21
21
|
|
|
22
22
|
respond_to do |format|
|
|
23
23
|
format.html do
|
|
24
24
|
redirect_to oauth_authorized_applications_url, notice: I18n.t(
|
|
25
|
-
:notice, scope: %i[doorkeeper flash authorized_applications destroy]
|
|
25
|
+
:notice, scope: %i[doorkeeper flash authorized_applications destroy],
|
|
26
26
|
)
|
|
27
27
|
end
|
|
28
28
|
|
|
@@ -6,8 +6,8 @@ module Doorkeeper
|
|
|
6
6
|
headers.merge!(authorize_response.headers)
|
|
7
7
|
render json: authorize_response.body,
|
|
8
8
|
status: authorize_response.status
|
|
9
|
-
rescue Errors::DoorkeeperError =>
|
|
10
|
-
handle_token_exception(
|
|
9
|
+
rescue Errors::DoorkeeperError => e
|
|
10
|
+
handle_token_exception(e)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
# OAuth 2.0 Token Revocation - http://tools.ietf.org/html/rfc7009
|
|
@@ -18,12 +18,13 @@ module Doorkeeper
|
|
|
18
18
|
# Doorkeeper does not use the token_type_hint logic described in the
|
|
19
19
|
# RFC 7009 due to the refresh token implementation that is a field in
|
|
20
20
|
# the access token model.
|
|
21
|
-
revoke_token if authorized?
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
if authorized?
|
|
23
|
+
revoke_token
|
|
24
|
+
render json: {}, status: 200
|
|
25
|
+
else
|
|
26
|
+
render json: revocation_error_response, status: :forbidden
|
|
27
|
+
end
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def introspect
|
|
@@ -71,7 +72,10 @@ module Doorkeeper
|
|
|
71
72
|
end
|
|
72
73
|
|
|
73
74
|
def revoke_token
|
|
74
|
-
|
|
75
|
+
# The authorization server responds with HTTP status code 200 if the token
|
|
76
|
+
# has been revoked successfully or if the client submitted an invalid
|
|
77
|
+
# token
|
|
78
|
+
token.revoke if token&.accessible?
|
|
75
79
|
end
|
|
76
80
|
|
|
77
81
|
def token
|
|
@@ -84,7 +88,26 @@ module Doorkeeper
|
|
|
84
88
|
end
|
|
85
89
|
|
|
86
90
|
def authorize_response
|
|
87
|
-
@authorize_response ||=
|
|
91
|
+
@authorize_response ||= begin
|
|
92
|
+
before_successful_authorization
|
|
93
|
+
auth = strategy.authorize
|
|
94
|
+
after_successful_authorization unless auth.is_a?(Doorkeeper::OAuth::ErrorResponse)
|
|
95
|
+
auth
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def after_successful_authorization
|
|
100
|
+
Doorkeeper.configuration.after_successful_authorization.call(self)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def before_successful_authorization
|
|
104
|
+
Doorkeeper.configuration.before_successful_authorization.call(self)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def revocation_error_response
|
|
108
|
+
error_description = I18n.t(:unauthorized, scope: %i[doorkeeper errors messages revoke])
|
|
109
|
+
|
|
110
|
+
{ error: :unauthorized_client, error_description: error_description }
|
|
88
111
|
end
|
|
89
112
|
end
|
|
90
113
|
end
|
|
@@ -20,12 +20,6 @@
|
|
|
20
20
|
<%= t('doorkeeper.applications.help.redirect_uri') %>
|
|
21
21
|
</span>
|
|
22
22
|
|
|
23
|
-
<% if Doorkeeper.configuration.native_redirect_uri %>
|
|
24
|
-
<span class="form-text text-secondary">
|
|
25
|
-
<%= raw t('doorkeeper.applications.help.native_redirect_uri', native_redirect_uri: content_tag(:code, class: 'bg-light') { Doorkeeper.configuration.native_redirect_uri }) %>
|
|
26
|
-
</span>
|
|
27
|
-
<% end %>
|
|
28
|
-
|
|
29
23
|
<% if Doorkeeper.configuration.allow_blank_redirect_uri?(application) %>
|
|
30
24
|
<span class="form-text text-secondary">
|
|
31
25
|
<%= t('doorkeeper.applications.help.blank_redirect_uri') %>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<p><code class="bg-light" id="application_id"><%= @application.uid %></code></p>
|
|
9
9
|
|
|
10
10
|
<h4><%= t('.secret') %>:</h4>
|
|
11
|
-
<p><code class="bg-light" id="secret"><%= @application.plaintext_secret %></code></p>
|
|
11
|
+
<p><code class="bg-light" id="secret"><%= flash[:application_secret].presence || @application.plaintext_secret %></code></p>
|
|
12
12
|
|
|
13
13
|
<h4><%= t('.scopes') %>:</h4>
|
|
14
14
|
<p><code class="bg-light" id="scopes"><%= @application.scopes.presence || raw(' ') %></code></p>
|
data/config/locales/en.yml
CHANGED
|
@@ -11,6 +11,7 @@ en:
|
|
|
11
11
|
redirect_uri:
|
|
12
12
|
fragment_present: 'cannot contain a fragment.'
|
|
13
13
|
invalid_uri: 'must be a valid URI.'
|
|
14
|
+
unspecified_scheme: 'must specify a scheme.'
|
|
14
15
|
relative_uri: 'must be an absolute URI.'
|
|
15
16
|
secured_uri: 'must be an HTTPS/SSL URI.'
|
|
16
17
|
forbidden_uri: 'is forbidden by the server.'
|
|
@@ -33,7 +34,6 @@ en:
|
|
|
33
34
|
confidential: 'Application will be used where the client secret can be kept confidential. Native mobile apps and Single Page Apps are considered non-confidential.'
|
|
34
35
|
redirect_uri: 'Use one line per URI'
|
|
35
36
|
blank_redirect_uri: "Leave it blank if you configured your provider to use Client Credentials, Resource Owner Password Credentials or any other grant type that doesn't require redirect URI."
|
|
36
|
-
native_redirect_uri: 'Use %{native_redirect_uri} if you want to add localhost URIs for development purposes'
|
|
37
37
|
scopes: 'Separate scopes with spaces. Leave blank to use the default scopes.'
|
|
38
38
|
edit:
|
|
39
39
|
title: 'Edit application'
|
|
@@ -88,7 +88,11 @@ en:
|
|
|
88
88
|
errors:
|
|
89
89
|
messages:
|
|
90
90
|
# Common error messages
|
|
91
|
-
invalid_request:
|
|
91
|
+
invalid_request:
|
|
92
|
+
unknown: 'The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.'
|
|
93
|
+
missing_param: 'Missing required parameter: %{value}.'
|
|
94
|
+
not_support_pkce: 'Invalid code_verifier parameter. Server does not support pkce.'
|
|
95
|
+
request_not_authorized: 'Request need to be authorized. Required parameter for authorizing request is missing or invalid.'
|
|
92
96
|
invalid_redirect_uri: "The requested redirect uri is malformed or doesn't match client redirect URI."
|
|
93
97
|
unauthorized_client: 'The client is not authorized to perform this request using this method.'
|
|
94
98
|
access_denied: 'The resource owner or authorization server denied the request.'
|
|
@@ -114,6 +118,8 @@ en:
|
|
|
114
118
|
revoked: "The access token was revoked"
|
|
115
119
|
expired: "The access token expired"
|
|
116
120
|
unknown: "The access token is invalid"
|
|
121
|
+
revoke:
|
|
122
|
+
unauthorized: "You are not authorized to revoke this token"
|
|
117
123
|
|
|
118
124
|
flash:
|
|
119
125
|
applications:
|
data/doorkeeper.gemspec
CHANGED
|
@@ -14,10 +14,18 @@ Gem::Specification.new do |gem|
|
|
|
14
14
|
gem.description = "Doorkeeper is an OAuth 2 provider for Rails and Grape."
|
|
15
15
|
gem.license = "MIT"
|
|
16
16
|
|
|
17
|
-
gem.files = `git ls-files`.split("\n")
|
|
17
|
+
gem.files = `git ls-files`.split("\n").reject { |file| file.start_with?(".") }
|
|
18
18
|
gem.test_files = `git ls-files -- spec/*`.split("\n")
|
|
19
19
|
gem.require_paths = ["lib"]
|
|
20
20
|
|
|
21
|
+
gem.metadata = {
|
|
22
|
+
"homepage_uri" => "https://github.com/doorkeeper-gem/doorkeeper",
|
|
23
|
+
"changelog_uri" => "https://github.com/doorkeeper-gem/doorkeeper/blob/master/CHANGELOG.md",
|
|
24
|
+
"source_code_uri" => "https://github.com/doorkeeper-gem/doorkeeper",
|
|
25
|
+
"bug_tracker_uri" => "https://github.com/doorkeeper-gem/doorkeeper/issues",
|
|
26
|
+
"documentation_uri" => "https://doorkeeper.gitbook.io/guides/",
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
gem.add_dependency "railties", ">= 5"
|
|
22
30
|
gem.required_ruby_version = ">= 2.4"
|
|
23
31
|
|
data/gemfiles/rails_5_0.gemfile
CHANGED
|
@@ -6,9 +6,10 @@ gem "rails", "~> 5.0.0"
|
|
|
6
6
|
gem "rspec-core", git: "https://github.com/rspec/rspec-core.git"
|
|
7
7
|
gem "rspec-expectations", git: "https://github.com/rspec/rspec-expectations.git"
|
|
8
8
|
gem "rspec-mocks", git: "https://github.com/rspec/rspec-mocks.git"
|
|
9
|
-
gem "rspec-rails",
|
|
9
|
+
gem "rspec-rails", "4.0.0.beta3"
|
|
10
10
|
gem "rspec-support", git: "https://github.com/rspec/rspec-support.git"
|
|
11
|
-
gem "rubocop", "~> 0.
|
|
11
|
+
gem "rubocop", "~> 0.75"
|
|
12
|
+
gem "rubocop-performance"
|
|
12
13
|
gem "bcrypt", "~> 3.1", require: false
|
|
13
14
|
gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
|
|
14
15
|
gem "sqlite3", "~> 1.3", "< 1.4", platform: [:ruby, :mswin, :mingw, :x64_mingw]
|
data/gemfiles/rails_5_1.gemfile
CHANGED
|
@@ -6,9 +6,10 @@ gem "rails", "~> 5.1.0"
|
|
|
6
6
|
gem "rspec-core", git: "https://github.com/rspec/rspec-core.git"
|
|
7
7
|
gem "rspec-expectations", git: "https://github.com/rspec/rspec-expectations.git"
|
|
8
8
|
gem "rspec-mocks", git: "https://github.com/rspec/rspec-mocks.git"
|
|
9
|
-
gem "rspec-rails",
|
|
9
|
+
gem "rspec-rails", "4.0.0.beta3"
|
|
10
10
|
gem "rspec-support", git: "https://github.com/rspec/rspec-support.git"
|
|
11
|
-
gem "rubocop", "~> 0.
|
|
11
|
+
gem "rubocop", "~> 0.75"
|
|
12
|
+
gem "rubocop-performance"
|
|
12
13
|
gem "bcrypt", "~> 3.1", require: false
|
|
13
14
|
gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
|
|
14
15
|
gem "sqlite3", "~> 1.3", "< 1.4", platform: [:ruby, :mswin, :mingw, :x64_mingw]
|
data/gemfiles/rails_5_2.gemfile
CHANGED
|
@@ -6,9 +6,10 @@ gem "rails", "~> 5.2.0"
|
|
|
6
6
|
gem "rspec-core", git: "https://github.com/rspec/rspec-core.git"
|
|
7
7
|
gem "rspec-expectations", git: "https://github.com/rspec/rspec-expectations.git"
|
|
8
8
|
gem "rspec-mocks", git: "https://github.com/rspec/rspec-mocks.git"
|
|
9
|
-
gem "rspec-rails",
|
|
9
|
+
gem "rspec-rails", "4.0.0.beta3"
|
|
10
10
|
gem "rspec-support", git: "https://github.com/rspec/rspec-support.git"
|
|
11
|
-
gem "rubocop", "~> 0.
|
|
11
|
+
gem "rubocop", "~> 0.75"
|
|
12
|
+
gem "rubocop-performance"
|
|
12
13
|
gem "bcrypt", "~> 3.1", require: false
|
|
13
14
|
gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
|
|
14
15
|
gem "sqlite3", "~> 1.3", "< 1.4", platform: [:ruby, :mswin, :mingw, :x64_mingw]
|
data/gemfiles/rails_6_0.gemfile
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
4
|
|
|
5
|
-
gem "rails", "~> 6.0.0
|
|
5
|
+
gem "rails", "~> 6.0.0"
|
|
6
6
|
gem "rspec-core", git: "https://github.com/rspec/rspec-core.git"
|
|
7
7
|
gem "rspec-expectations", git: "https://github.com/rspec/rspec-expectations.git"
|
|
8
8
|
gem "rspec-mocks", git: "https://github.com/rspec/rspec-mocks.git"
|
|
9
|
-
gem "rspec-rails",
|
|
9
|
+
gem "rspec-rails", "4.0.0.beta3"
|
|
10
10
|
gem "rspec-support", git: "https://github.com/rspec/rspec-support.git"
|
|
11
|
-
gem "rubocop", "~> 0.
|
|
11
|
+
gem "rubocop", "~> 0.75"
|
|
12
|
+
gem "rubocop-performance"
|
|
12
13
|
gem "bcrypt", "~> 3.1", require: false
|
|
13
14
|
gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
|
|
14
15
|
gem "sqlite3", "~> 1.4", platform: [:ruby, :mswin, :mingw, :x64_mingw]
|
|
@@ -6,9 +6,10 @@ gem "rails", git: "https://github.com/rails/rails"
|
|
|
6
6
|
gem "rspec-core", git: "https://github.com/rspec/rspec-core.git"
|
|
7
7
|
gem "rspec-expectations", git: "https://github.com/rspec/rspec-expectations.git"
|
|
8
8
|
gem "rspec-mocks", git: "https://github.com/rspec/rspec-mocks.git"
|
|
9
|
-
gem "rspec-rails",
|
|
9
|
+
gem "rspec-rails", "4.0.0.beta3"
|
|
10
10
|
gem "rspec-support", git: "https://github.com/rspec/rspec-support.git"
|
|
11
|
-
gem "rubocop", "~> 0.
|
|
11
|
+
gem "rubocop", "~> 0.75"
|
|
12
|
+
gem "rubocop-performance"
|
|
12
13
|
gem "bcrypt", "~> 3.1", require: false
|
|
13
14
|
gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
|
|
14
15
|
gem "sqlite3", "~> 1.4", platform: [:ruby, :mswin, :mingw, :x64_mingw]
|
|
@@ -38,14 +38,20 @@ module Doorkeeper
|
|
|
38
38
|
|
|
39
39
|
Builder.instance_eval do
|
|
40
40
|
remove_method name if method_defined?(name)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
if options[:deprecated]
|
|
42
|
+
define_method name do |*_, &_|
|
|
43
|
+
Kernel.warn "[DOORKEEPER] #{name} has been deprecated and will soon be removed"
|
|
44
|
+
end
|
|
45
|
+
else
|
|
46
|
+
define_method name do |*args, &block|
|
|
47
|
+
value = if attribute_builder
|
|
48
|
+
attribute_builder.new(&block).build
|
|
49
|
+
else
|
|
50
|
+
block || args.first
|
|
51
|
+
end
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
@config.instance_variable_set(:"@#{attribute}", value)
|
|
54
|
+
end
|
|
49
55
|
end
|
|
50
56
|
end
|
|
51
57
|
|