super-smart-kit 0.0.1
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 +7 -0
- data/doorkeeper-5.9.3/CHANGELOG.md +1208 -0
- data/doorkeeper-5.9.3/MIT-LICENSE +20 -0
- data/doorkeeper-5.9.3/README.md +186 -0
- data/doorkeeper-5.9.3/app/assets/stylesheets/doorkeeper/admin/application.css +10 -0
- data/doorkeeper-5.9.3/app/assets/stylesheets/doorkeeper/application.css +64 -0
- data/doorkeeper-5.9.3/app/controllers/doorkeeper/application_controller.rb +14 -0
- data/doorkeeper-5.9.3/app/controllers/doorkeeper/application_metal_controller.rb +13 -0
- data/doorkeeper-5.9.3/app/controllers/doorkeeper/applications_controller.rb +99 -0
- data/doorkeeper-5.9.3/app/controllers/doorkeeper/authorizations_controller.rb +164 -0
- data/doorkeeper-5.9.3/app/controllers/doorkeeper/authorized_applications_controller.rb +33 -0
- data/doorkeeper-5.9.3/app/controllers/doorkeeper/token_info_controller.rb +25 -0
- data/doorkeeper-5.9.3/app/controllers/doorkeeper/tokens_controller.rb +180 -0
- data/doorkeeper-5.9.3/app/helpers/doorkeeper/dashboard_helper.rb +21 -0
- data/doorkeeper-5.9.3/app/views/doorkeeper/applications/_delete_form.html.erb +6 -0
- data/doorkeeper-5.9.3/app/views/doorkeeper/applications/_form.html.erb +59 -0
- data/doorkeeper-5.9.3/app/views/doorkeeper/applications/edit.html.erb +5 -0
- data/doorkeeper-5.9.3/app/views/doorkeeper/applications/index.html.erb +38 -0
- data/doorkeeper-5.9.3/app/views/doorkeeper/applications/new.html.erb +5 -0
- data/doorkeeper-5.9.3/app/views/doorkeeper/applications/show.html.erb +63 -0
- data/doorkeeper-5.9.3/app/views/doorkeeper/authorizations/error.html.erb +9 -0
- data/doorkeeper-5.9.3/app/views/doorkeeper/authorizations/form_post.html.erb +15 -0
- data/doorkeeper-5.9.3/app/views/doorkeeper/authorizations/new.html.erb +46 -0
- data/doorkeeper-5.9.3/app/views/doorkeeper/authorizations/show.html.erb +7 -0
- data/doorkeeper-5.9.3/app/views/doorkeeper/authorized_applications/_delete_form.html.erb +4 -0
- data/doorkeeper-5.9.3/app/views/doorkeeper/authorized_applications/index.html.erb +24 -0
- data/doorkeeper-5.9.3/app/views/layouts/doorkeeper/admin.html.erb +39 -0
- data/doorkeeper-5.9.3/app/views/layouts/doorkeeper/application.html.erb +23 -0
- data/doorkeeper-5.9.3/config/locales/en.yml +155 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/config/abstract_builder.rb +28 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/config/option.rb +82 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/config/validations.rb +65 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/config.rb +721 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/engine.rb +38 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/errors.rb +85 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/grant_flow/fallback_flow.rb +15 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/grant_flow/flow.rb +44 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/grant_flow/registry.rb +50 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/grant_flow.rb +45 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/grape/authorization_decorator.rb +19 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/grape/helpers.rb +58 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/helpers/controller.rb +91 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/access_grant_mixin.rb +124 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/access_token_mixin.rb +526 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/application_mixin.rb +96 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/concerns/accessible.rb +15 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/concerns/expirable.rb +36 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/concerns/expiration_time_sql_math.rb +96 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/concerns/orderable.rb +15 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/concerns/ownership.rb +18 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/concerns/polymorphic_resource_owner.rb +29 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/concerns/resource_ownerable.rb +47 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/concerns/reusable.rb +19 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/concerns/revocable.rb +31 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/concerns/scopes.rb +27 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/concerns/secret_storable.rb +106 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/models/concerns/write_to_primary.rb +57 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/authorization/code.rb +76 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/authorization/context.rb +17 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/authorization/token.rb +100 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/authorization/uri_builder.rb +33 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/authorization_code_request.rb +125 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/base_request.rb +68 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/base_response.rb +31 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/client/credentials.rb +34 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/client.rb +28 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/client_credentials/creator.rb +57 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/client_credentials/issuer.rb +48 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/client_credentials/validator.rb +55 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/client_credentials_request.rb +46 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/code_request.rb +25 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/code_response.rb +51 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/error.rb +16 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/error_response.rb +121 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/forbidden_token_response.rb +31 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/helpers/scope_checker.rb +50 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/helpers/unique_token.rb +30 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/helpers/uri_checker.rb +83 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/hooks/context.rb +21 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/invalid_request_response.rb +47 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/invalid_token_response.rb +54 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/nonstandard.rb +39 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/password_access_token_request.rb +75 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/pre_authorization.rb +187 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/refresh_token_request.rb +144 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/scopes.rb +134 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/token.rb +66 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/token_introspection.rb +220 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/token_request.rb +25 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth/token_response.rb +38 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/oauth.rb +13 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/orm/active_record/access_grant.rb +9 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/orm/active_record/access_token.rb +9 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/orm/active_record/application.rb +10 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/orm/active_record/mixins/access_grant.rb +64 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/orm/active_record/mixins/access_token.rb +95 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/orm/active_record/mixins/application.rb +223 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/orm/active_record/redirect_uri_validator.rb +66 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/orm/active_record/stale_records_cleaner.rb +44 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/orm/active_record.rb +41 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/rails/helpers.rb +82 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/rails/routes/abstract_router.rb +35 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/rails/routes/mapper.rb +30 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/rails/routes/mapping.rb +40 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/rails/routes/registry.rb +45 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/rails/routes.rb +110 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/rake/db.rake +40 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/rake/setup.rake +6 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/rake.rb +14 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/request/authorization_code.rb +26 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/request/client_credentials.rb +17 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/request/code.rb +17 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/request/password.rb +19 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/request/refresh_token.rb +22 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/request/strategy.rb +19 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/request/token.rb +17 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/request.rb +73 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/revocable_tokens/revocable_access_token.rb +21 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/revocable_tokens/revocable_refresh_token.rb +21 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/secret_storing/base.rb +64 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/secret_storing/bcrypt.rb +60 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/secret_storing/plain.rb +33 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/secret_storing/sha256_hash.rb +26 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/server.rb +44 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/stale_records_cleaner.rb +24 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/validations.rb +33 -0
- data/doorkeeper-5.9.3/lib/doorkeeper/version.rb +14 -0
- data/doorkeeper-5.9.3/lib/doorkeeper.rb +209 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/application_owner_generator.rb +33 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/confidential_applications_generator.rb +33 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/enable_polymorphic_resource_owner_generator.rb +39 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/install_generator.rb +22 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/migration_generator.rb +32 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/pkce_generator.rb +33 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/previous_refresh_token_generator.rb +41 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/remove_applications_secret_not_null_constraint_generator.rb +33 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/templates/README +24 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/templates/add_confidential_to_applications.rb.erb +13 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb.erb +9 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/templates/add_previous_refresh_token_to_access_tokens.rb.erb +13 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/templates/enable_pkce_migration.rb.erb +8 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/templates/enable_polymorphic_resource_owner_migration.rb.erb +17 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/templates/initializer.rb +544 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/templates/migration.rb.erb +99 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/templates/remove_applications_secret_not_null_constraint.rb.erb +7 -0
- data/doorkeeper-5.9.3/lib/generators/doorkeeper/views_generator.rb +18 -0
- data/doorkeeper-5.9.3/vendor/assets/stylesheets/doorkeeper/bootstrap.min.css +6 -0
- data/super-smart-kit.gemspec +12 -0
- metadata +188 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
en:
|
|
2
|
+
activerecord:
|
|
3
|
+
attributes:
|
|
4
|
+
doorkeeper/application:
|
|
5
|
+
name: 'Name'
|
|
6
|
+
redirect_uri: 'Redirect URI'
|
|
7
|
+
errors:
|
|
8
|
+
models:
|
|
9
|
+
doorkeeper/application:
|
|
10
|
+
attributes:
|
|
11
|
+
redirect_uri:
|
|
12
|
+
fragment_present: 'cannot contain a fragment.'
|
|
13
|
+
invalid_uri: 'must be a valid URI.'
|
|
14
|
+
unspecified_scheme: 'must specify a scheme.'
|
|
15
|
+
relative_uri: 'must be an absolute URI.'
|
|
16
|
+
secured_uri: 'must be an HTTPS/SSL URI.'
|
|
17
|
+
forbidden_uri: 'is forbidden by the server.'
|
|
18
|
+
scopes:
|
|
19
|
+
not_match_configured: "doesn't match those configured on the server."
|
|
20
|
+
|
|
21
|
+
doorkeeper:
|
|
22
|
+
applications:
|
|
23
|
+
confirmations:
|
|
24
|
+
destroy: 'Are you sure?'
|
|
25
|
+
buttons:
|
|
26
|
+
edit: 'Edit'
|
|
27
|
+
destroy: 'Destroy'
|
|
28
|
+
submit: 'Submit'
|
|
29
|
+
cancel: 'Cancel'
|
|
30
|
+
authorize: 'Authorize'
|
|
31
|
+
form:
|
|
32
|
+
error: 'Whoops! Check your form for possible errors'
|
|
33
|
+
help:
|
|
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.'
|
|
35
|
+
redirect_uri: 'Use one line per URI'
|
|
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 a redirect URI."
|
|
37
|
+
scopes: 'Separate scopes with spaces. Leave blank to use the default scopes.'
|
|
38
|
+
edit:
|
|
39
|
+
title: 'Edit application'
|
|
40
|
+
index:
|
|
41
|
+
title: 'Your applications'
|
|
42
|
+
new: 'New Application'
|
|
43
|
+
name: 'Name'
|
|
44
|
+
callback_url: 'Callback URL'
|
|
45
|
+
confidential: 'Confidential?'
|
|
46
|
+
actions: 'Actions'
|
|
47
|
+
confidentiality:
|
|
48
|
+
'yes': 'Yes'
|
|
49
|
+
'no': 'No'
|
|
50
|
+
new:
|
|
51
|
+
title: 'New Application'
|
|
52
|
+
show:
|
|
53
|
+
title: 'Application: %{name}'
|
|
54
|
+
application_id: 'UID:'
|
|
55
|
+
secret: 'Secret:'
|
|
56
|
+
secret_hashed: 'Secret hashed'
|
|
57
|
+
scopes: 'Scopes:'
|
|
58
|
+
confidential: 'Confidential:'
|
|
59
|
+
callback_urls: 'Callback URLs:'
|
|
60
|
+
actions: 'Actions'
|
|
61
|
+
not_defined: 'Not defined'
|
|
62
|
+
|
|
63
|
+
authorizations:
|
|
64
|
+
buttons:
|
|
65
|
+
authorize: 'Authorize'
|
|
66
|
+
deny: 'Deny'
|
|
67
|
+
error:
|
|
68
|
+
title: 'An error has occurred'
|
|
69
|
+
new:
|
|
70
|
+
title: 'Authorization required'
|
|
71
|
+
prompt: 'Authorize %{client_name} to use your account?'
|
|
72
|
+
able_to: 'This application will be able to:'
|
|
73
|
+
show:
|
|
74
|
+
title: 'Authorization code:'
|
|
75
|
+
form_post:
|
|
76
|
+
title: 'Submit this form'
|
|
77
|
+
|
|
78
|
+
authorized_applications:
|
|
79
|
+
confirmations:
|
|
80
|
+
revoke: 'Are you sure?'
|
|
81
|
+
buttons:
|
|
82
|
+
revoke: 'Revoke'
|
|
83
|
+
index:
|
|
84
|
+
title: 'Your authorized applications'
|
|
85
|
+
application: 'Application'
|
|
86
|
+
created_at: 'Created At'
|
|
87
|
+
date_format: '%Y-%m-%d %H:%M:%S'
|
|
88
|
+
|
|
89
|
+
pre_authorization:
|
|
90
|
+
status: 'Pre-authorization'
|
|
91
|
+
|
|
92
|
+
errors:
|
|
93
|
+
messages:
|
|
94
|
+
# Common error messages
|
|
95
|
+
invalid_request:
|
|
96
|
+
unknown: 'The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.'
|
|
97
|
+
missing_param: 'Missing required parameter: %{value}.'
|
|
98
|
+
request_not_authorized: 'Request needs to be authorized. Required parameter for authorizing the request is missing or invalid.'
|
|
99
|
+
invalid_code_challenge: 'Code challenge is required.'
|
|
100
|
+
invalid_redirect_uri: "The requested redirect URI is malformed or doesn't match the client redirect URI."
|
|
101
|
+
unauthorized_client: 'The client is not authorized to perform this request using this method.'
|
|
102
|
+
access_denied: 'The resource owner or authorization server denied the request.'
|
|
103
|
+
invalid_scope: 'The requested scope is invalid, unknown, or malformed.'
|
|
104
|
+
invalid_code_challenge_method:
|
|
105
|
+
zero: 'The authorization server does not support PKCE as there are no accepted code_challenge_method values.'
|
|
106
|
+
one: 'The code_challenge_method must be %{challenge_methods}.'
|
|
107
|
+
other: 'The code_challenge_method must be one of %{challenge_methods}.'
|
|
108
|
+
server_error: 'The authorization server encountered an unexpected condition which prevented it from fulfilling the request.'
|
|
109
|
+
temporarily_unavailable: 'The authorization server is currently unable to handle the request due to a temporary overloading or maintenance of the server.'
|
|
110
|
+
|
|
111
|
+
# Configuration error messages
|
|
112
|
+
credential_flow_not_configured: 'Resource Owner Password Credentials flow failed due to Doorkeeper.configure.resource_owner_from_credentials being unconfigured.'
|
|
113
|
+
resource_owner_authenticator_not_configured: 'Resource Owner find failed due to Doorkeeper.configure.resource_owner_authenticator being unconfigured.'
|
|
114
|
+
admin_authenticator_not_configured: 'Access to admin panel is forbidden due to Doorkeeper.configure.admin_authenticator being unconfigured.'
|
|
115
|
+
|
|
116
|
+
# Access grant errors
|
|
117
|
+
unsupported_response_type: 'The authorization server does not support this response type.'
|
|
118
|
+
unsupported_response_mode: 'The authorization server does not support this response mode.'
|
|
119
|
+
|
|
120
|
+
# Access token errors
|
|
121
|
+
invalid_client: 'Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method.'
|
|
122
|
+
invalid_grant: 'The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.'
|
|
123
|
+
unsupported_grant_type: 'The authorization grant type is not supported by the authorization server.'
|
|
124
|
+
|
|
125
|
+
invalid_token:
|
|
126
|
+
revoked: "The access token was revoked"
|
|
127
|
+
expired: "The access token expired"
|
|
128
|
+
unknown: "The access token is invalid"
|
|
129
|
+
revoke:
|
|
130
|
+
unauthorized: "You are not authorized to revoke this token"
|
|
131
|
+
|
|
132
|
+
forbidden_token:
|
|
133
|
+
missing_scope: 'Access to this resource requires scope "%{oauth_scopes}".'
|
|
134
|
+
|
|
135
|
+
flash:
|
|
136
|
+
applications:
|
|
137
|
+
create:
|
|
138
|
+
notice: 'Application created.'
|
|
139
|
+
destroy:
|
|
140
|
+
notice: 'Application deleted.'
|
|
141
|
+
update:
|
|
142
|
+
notice: 'Application updated.'
|
|
143
|
+
authorized_applications:
|
|
144
|
+
destroy:
|
|
145
|
+
notice: 'Application revoked.'
|
|
146
|
+
|
|
147
|
+
layouts:
|
|
148
|
+
admin:
|
|
149
|
+
title: 'Doorkeeper'
|
|
150
|
+
nav:
|
|
151
|
+
oauth2_provider: 'OAuth2 Provider'
|
|
152
|
+
applications: 'Applications'
|
|
153
|
+
home: 'Home'
|
|
154
|
+
application:
|
|
155
|
+
title: 'OAuth authorization required'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Doorkeeper
|
|
4
|
+
class Config
|
|
5
|
+
# Abstract base class for Doorkeeper and it's extensions configuration
|
|
6
|
+
# builder. Instantiates and validates gem configuration.
|
|
7
|
+
#
|
|
8
|
+
class AbstractBuilder
|
|
9
|
+
attr_reader :config
|
|
10
|
+
|
|
11
|
+
# @param [Class] config class
|
|
12
|
+
#
|
|
13
|
+
def initialize(config = Config.new, &block)
|
|
14
|
+
@config = config
|
|
15
|
+
instance_eval(&block) if block_given?
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Builds and validates configuration.
|
|
19
|
+
#
|
|
20
|
+
# @return [Doorkeeper::Config] config instance
|
|
21
|
+
#
|
|
22
|
+
def build
|
|
23
|
+
@config.validate! if @config.respond_to?(:validate!)
|
|
24
|
+
@config
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Doorkeeper
|
|
4
|
+
class Config
|
|
5
|
+
# Doorkeeper configuration option DSL
|
|
6
|
+
module Option
|
|
7
|
+
# Defines configuration option
|
|
8
|
+
#
|
|
9
|
+
# When you call option, it defines two methods. One method will take place
|
|
10
|
+
# in the +Config+ class and the other method will take place in the
|
|
11
|
+
# +Builder+ class.
|
|
12
|
+
#
|
|
13
|
+
# The +name+ parameter will set both builder method and config attribute.
|
|
14
|
+
# If the +:as+ option is defined, the builder method will be the specified
|
|
15
|
+
# option while the config attribute will be the +name+ parameter.
|
|
16
|
+
#
|
|
17
|
+
# If you want to introduce another level of config DSL you can
|
|
18
|
+
# define +builder_class+ parameter.
|
|
19
|
+
# Builder should take a block as the initializer parameter and respond to function +build+
|
|
20
|
+
# that returns the value of the config attribute.
|
|
21
|
+
#
|
|
22
|
+
# ==== Options
|
|
23
|
+
#
|
|
24
|
+
# * [:+as+] Set the builder method that goes inside +configure+ block
|
|
25
|
+
# * [+:default+] The default value in case no option was set
|
|
26
|
+
# * [+:builder_class+] Configuration option builder class
|
|
27
|
+
#
|
|
28
|
+
# ==== Examples
|
|
29
|
+
#
|
|
30
|
+
# option :name
|
|
31
|
+
# option :name, as: :set_name
|
|
32
|
+
# option :name, default: 'My Name'
|
|
33
|
+
# option :scopes builder_class: ScopesBuilder
|
|
34
|
+
#
|
|
35
|
+
def option(name, options = {})
|
|
36
|
+
attribute = options[:as] || name
|
|
37
|
+
attribute_builder = options[:builder_class]
|
|
38
|
+
|
|
39
|
+
builder_class.instance_eval do
|
|
40
|
+
if method_defined?(name)
|
|
41
|
+
Kernel.warn "[DOORKEEPER] Option #{name} already defined and will be overridden"
|
|
42
|
+
remove_method name
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
define_method name do |*args, &block|
|
|
46
|
+
if (deprecation_opts = options[:deprecated])
|
|
47
|
+
warning = "[DOORKEEPER] #{name} has been deprecated and will soon be removed"
|
|
48
|
+
warning = "#{warning}\n#{deprecation_opts.fetch(:message)}" if deprecation_opts.is_a?(Hash)
|
|
49
|
+
|
|
50
|
+
Kernel.warn(warning)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
value = if attribute_builder
|
|
54
|
+
attribute_builder.new(&block).build
|
|
55
|
+
else
|
|
56
|
+
block || args.first
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
@config.instance_variable_set(:"@#{attribute}", value)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
define_method attribute do |*_args|
|
|
64
|
+
if instance_variable_defined?(:"@#{attribute}")
|
|
65
|
+
instance_variable_get(:"@#{attribute}")
|
|
66
|
+
else
|
|
67
|
+
options[:default]
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
public attribute
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def self.extended(base)
|
|
75
|
+
return if base.respond_to?(:builder_class)
|
|
76
|
+
|
|
77
|
+
raise Doorkeeper::MissingConfigurationBuilderClass, "Define `self.builder_class` method " \
|
|
78
|
+
"for #{base} that returns your custom Builder class to use options DSL!"
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Doorkeeper
|
|
4
|
+
class Config
|
|
5
|
+
# Doorkeeper configuration validator.
|
|
6
|
+
#
|
|
7
|
+
module Validations
|
|
8
|
+
# Validates configuration options to be set properly.
|
|
9
|
+
#
|
|
10
|
+
def validate!
|
|
11
|
+
validate_reuse_access_token_value
|
|
12
|
+
validate_token_reuse_limit
|
|
13
|
+
validate_secret_strategies
|
|
14
|
+
validate_pkce_code_challenge_methods
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
# Determine whether +reuse_access_token+ and a non-restorable
|
|
20
|
+
# +token_secret_strategy+ have both been activated.
|
|
21
|
+
#
|
|
22
|
+
# In that case, disable reuse_access_token value and warn the user.
|
|
23
|
+
def validate_reuse_access_token_value
|
|
24
|
+
strategy = token_secret_strategy
|
|
25
|
+
return if !reuse_access_token || strategy.allows_restoring_secrets?
|
|
26
|
+
|
|
27
|
+
::Rails.logger.warn(
|
|
28
|
+
"[DOORKEEPER] You have configured both reuse_access_token " \
|
|
29
|
+
"AND '#{strategy}' strategy which cannot restore tokens. " \
|
|
30
|
+
"This combination is unsupported. reuse_access_token will be disabled",
|
|
31
|
+
)
|
|
32
|
+
@reuse_access_token = false
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Validate that the provided strategies are valid for
|
|
36
|
+
# tokens and applications
|
|
37
|
+
def validate_secret_strategies
|
|
38
|
+
token_secret_strategy.validate_for(:token)
|
|
39
|
+
application_secret_strategy.validate_for(:application)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def validate_token_reuse_limit
|
|
43
|
+
return if !reuse_access_token ||
|
|
44
|
+
(token_reuse_limit > 0 && token_reuse_limit <= 100)
|
|
45
|
+
|
|
46
|
+
::Rails.logger.warn(
|
|
47
|
+
"[DOORKEEPER] You have configured an invalid value for token_reuse_limit option. " \
|
|
48
|
+
"It will be set to default 100",
|
|
49
|
+
)
|
|
50
|
+
@token_reuse_limit = 100
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def validate_pkce_code_challenge_methods
|
|
54
|
+
return if pkce_code_challenge_methods.all? { |method| method =~ /^plain$|^S256$/ }
|
|
55
|
+
|
|
56
|
+
::Rails.logger.warn(
|
|
57
|
+
"[DOORKEEPER] You have configured an invalid value for pkce_code_challenge_methods option. " \
|
|
58
|
+
"It will be set to default ['plain', 'S256']",
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
@pkce_code_challenge_methods = ["plain", "S256"]
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|