doorkeeper 3.1.0 → 5.6.2
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 +5 -5
- data/CHANGELOG.md +1079 -0
- data/README.md +114 -326
- data/app/assets/stylesheets/doorkeeper/admin/application.css +2 -2
- data/app/controllers/doorkeeper/application_controller.rb +7 -6
- data/app/controllers/doorkeeper/application_metal_controller.rb +9 -12
- data/app/controllers/doorkeeper/applications_controller.rb +66 -21
- data/app/controllers/doorkeeper/authorizations_controller.rb +100 -18
- data/app/controllers/doorkeeper/authorized_applications_controller.rb +23 -4
- data/app/controllers/doorkeeper/token_info_controller.rb +16 -4
- data/app/controllers/doorkeeper/tokens_controller.rb +138 -22
- data/app/helpers/doorkeeper/dashboard_helper.rb +15 -9
- data/app/views/doorkeeper/applications/_delete_form.html.erb +4 -3
- data/app/views/doorkeeper/applications/_form.html.erb +33 -21
- data/app/views/doorkeeper/applications/edit.html.erb +1 -1
- data/app/views/doorkeeper/applications/index.html.erb +18 -6
- data/app/views/doorkeeper/applications/new.html.erb +1 -1
- data/app/views/doorkeeper/applications/show.html.erb +40 -16
- data/app/views/doorkeeper/authorizations/error.html.erb +1 -1
- data/app/views/doorkeeper/authorizations/form_post.html.erb +15 -0
- data/app/views/doorkeeper/authorizations/new.html.erb +17 -11
- data/app/views/doorkeeper/authorized_applications/_delete_form.html.erb +1 -2
- data/app/views/doorkeeper/authorized_applications/index.html.erb +0 -1
- data/app/views/layouts/doorkeeper/admin.html.erb +16 -14
- data/config/locales/en.yml +37 -9
- data/lib/doorkeeper/config/abstract_builder.rb +28 -0
- data/lib/doorkeeper/config/option.rb +82 -0
- data/lib/doorkeeper/config/validations.rb +53 -0
- data/lib/doorkeeper/config.rb +602 -142
- data/lib/doorkeeper/engine.rb +22 -7
- data/lib/doorkeeper/errors.rb +37 -10
- 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/grant_flow.rb +45 -0
- data/lib/doorkeeper/grape/authorization_decorator.rb +6 -4
- data/lib/doorkeeper/grape/helpers.rb +24 -12
- data/lib/doorkeeper/helpers/controller.rb +49 -27
- data/lib/doorkeeper/models/access_grant_mixin.rb +99 -16
- data/lib/doorkeeper/models/access_token_mixin.rb +386 -77
- data/lib/doorkeeper/models/application_mixin.rb +73 -30
- data/lib/doorkeeper/models/concerns/accessible.rb +6 -0
- data/lib/doorkeeper/models/concerns/expirable.rb +20 -6
- data/lib/doorkeeper/models/concerns/expiration_time_sql_math.rb +88 -0
- data/lib/doorkeeper/models/concerns/orderable.rb +15 -0
- data/lib/doorkeeper/models/concerns/ownership.rb +4 -2
- data/lib/doorkeeper/models/concerns/resource_ownerable.rb +47 -0
- data/lib/doorkeeper/models/concerns/reusable.rb +19 -0
- data/lib/doorkeeper/models/concerns/revocable.rb +13 -2
- data/lib/doorkeeper/models/concerns/scopes.rb +12 -2
- data/lib/doorkeeper/models/concerns/secret_storable.rb +106 -0
- data/lib/doorkeeper/oauth/authorization/code.rb +48 -12
- data/lib/doorkeeper/oauth/authorization/context.rb +17 -0
- data/lib/doorkeeper/oauth/authorization/token.rb +72 -28
- data/lib/doorkeeper/oauth/authorization/uri_builder.rb +22 -18
- data/lib/doorkeeper/oauth/authorization_code_request.rb +64 -14
- data/lib/doorkeeper/oauth/base_request.rb +66 -0
- data/lib/doorkeeper/oauth/base_response.rb +31 -0
- data/lib/doorkeeper/oauth/client/credentials.rb +23 -10
- data/lib/doorkeeper/oauth/client.rb +10 -12
- data/lib/doorkeeper/oauth/client_credentials/creator.rb +48 -4
- data/lib/doorkeeper/oauth/client_credentials/issuer.rb +17 -9
- data/lib/doorkeeper/oauth/client_credentials/validator.rb +55 -0
- data/lib/doorkeeper/oauth/client_credentials_request.rb +14 -15
- data/lib/doorkeeper/oauth/code_request.rb +8 -12
- data/lib/doorkeeper/oauth/code_response.rb +31 -19
- data/lib/doorkeeper/oauth/error.rb +5 -3
- data/lib/doorkeeper/oauth/error_response.rb +41 -20
- data/lib/doorkeeper/oauth/forbidden_token_response.rb +11 -3
- data/lib/doorkeeper/oauth/helpers/scope_checker.rb +24 -19
- data/lib/doorkeeper/oauth/helpers/unique_token.rb +20 -3
- data/lib/doorkeeper/oauth/helpers/uri_checker.rb +55 -4
- data/lib/doorkeeper/oauth/hooks/context.rb +21 -0
- data/lib/doorkeeper/oauth/invalid_request_response.rb +43 -0
- data/lib/doorkeeper/oauth/invalid_token_response.rb +31 -5
- data/lib/doorkeeper/oauth/nonstandard.rb +39 -0
- data/lib/doorkeeper/oauth/password_access_token_request.rb +46 -18
- data/lib/doorkeeper/oauth/pre_authorization.rb +135 -26
- data/lib/doorkeeper/oauth/refresh_token_request.rb +67 -30
- data/lib/doorkeeper/oauth/scopes.rb +26 -12
- data/lib/doorkeeper/oauth/token.rb +28 -25
- data/lib/doorkeeper/oauth/token_introspection.rb +202 -0
- data/lib/doorkeeper/oauth/token_request.rb +8 -21
- data/lib/doorkeeper/oauth/token_response.rb +14 -10
- data/lib/doorkeeper/oauth.rb +13 -0
- data/lib/doorkeeper/orm/active_record/access_grant.rb +6 -4
- data/lib/doorkeeper/orm/active_record/access_token.rb +5 -17
- data/lib/doorkeeper/orm/active_record/application.rb +6 -20
- data/lib/doorkeeper/orm/active_record/mixins/access_grant.rb +69 -0
- data/lib/doorkeeper/orm/active_record/mixins/access_token.rb +81 -0
- data/lib/doorkeeper/orm/active_record/mixins/application.rb +214 -0
- data/lib/doorkeeper/orm/active_record/redirect_uri_validator.rb +66 -0
- data/lib/doorkeeper/orm/active_record/stale_records_cleaner.rb +33 -0
- data/lib/doorkeeper/orm/active_record.rb +36 -26
- data/lib/doorkeeper/rails/helpers.rb +14 -15
- data/lib/doorkeeper/rails/routes/abstract_router.rb +35 -0
- data/lib/doorkeeper/rails/routes/mapper.rb +4 -2
- data/lib/doorkeeper/rails/routes/mapping.rb +10 -8
- data/lib/doorkeeper/rails/routes/registry.rb +45 -0
- data/lib/doorkeeper/rails/routes.rb +45 -28
- data/lib/doorkeeper/rake/db.rake +40 -0
- data/lib/doorkeeper/rake/setup.rake +6 -0
- data/lib/doorkeeper/rake.rb +14 -0
- data/lib/doorkeeper/request/authorization_code.rb +12 -4
- data/lib/doorkeeper/request/client_credentials.rb +3 -3
- data/lib/doorkeeper/request/code.rb +1 -1
- data/lib/doorkeeper/request/password.rb +5 -4
- data/lib/doorkeeper/request/refresh_token.rb +6 -5
- data/lib/doorkeeper/request/strategy.rb +4 -2
- data/lib/doorkeeper/request/token.rb +1 -1
- data/lib/doorkeeper/request.rb +62 -29
- data/lib/doorkeeper/secret_storing/base.rb +64 -0
- data/lib/doorkeeper/secret_storing/bcrypt.rb +60 -0
- data/lib/doorkeeper/secret_storing/plain.rb +33 -0
- data/lib/doorkeeper/secret_storing/sha256_hash.rb +26 -0
- data/lib/doorkeeper/server.rb +9 -19
- data/lib/doorkeeper/stale_records_cleaner.rb +24 -0
- data/lib/doorkeeper/validations.rb +5 -2
- data/lib/doorkeeper/version.rb +12 -1
- data/lib/doorkeeper.rb +112 -56
- data/lib/generators/doorkeeper/application_owner_generator.rb +28 -13
- data/lib/generators/doorkeeper/confidential_applications_generator.rb +33 -0
- data/lib/generators/doorkeeper/enable_polymorphic_resource_owner_generator.rb +39 -0
- data/lib/generators/doorkeeper/install_generator.rb +19 -9
- data/lib/generators/doorkeeper/migration_generator.rb +27 -10
- data/lib/generators/doorkeeper/pkce_generator.rb +33 -0
- data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +41 -0
- data/lib/generators/doorkeeper/templates/add_confidential_to_applications.rb.erb +13 -0
- data/lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb.erb +9 -0
- data/lib/generators/doorkeeper/templates/add_previous_refresh_token_to_access_tokens.rb.erb +13 -0
- data/lib/generators/doorkeeper/templates/enable_pkce_migration.rb.erb +8 -0
- data/lib/generators/doorkeeper/templates/enable_polymorphic_resource_owner_migration.rb.erb +17 -0
- data/lib/generators/doorkeeper/templates/initializer.rb +417 -32
- data/lib/generators/doorkeeper/templates/migration.rb.erb +88 -0
- data/lib/generators/doorkeeper/views_generator.rb +8 -4
- data/vendor/assets/stylesheets/doorkeeper/bootstrap.min.css +4 -5
- metadata +163 -280
- data/.gitignore +0 -14
- data/.hound.yml +0 -13
- data/.rspec +0 -1
- data/.travis.yml +0 -22
- data/CONTRIBUTING.md +0 -45
- data/Gemfile +0 -10
- data/NEWS.md +0 -525
- data/RELEASING.md +0 -17
- data/Rakefile +0 -20
- data/app/validators/redirect_uri_validator.rb +0 -34
- data/doorkeeper.gemspec +0 -27
- data/lib/doorkeeper/oauth/client/methods.rb +0 -18
- data/lib/doorkeeper/oauth/client_credentials/validation.rb +0 -45
- data/lib/doorkeeper/oauth/request_concern.rb +0 -48
- data/lib/generators/doorkeeper/application_scopes_generator.rb +0 -34
- data/lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb +0 -7
- data/lib/generators/doorkeeper/templates/add_scopes_to_oauth_applications.rb +0 -5
- data/lib/generators/doorkeeper/templates/migration.rb +0 -50
- data/spec/controllers/applications_controller_spec.rb +0 -58
- data/spec/controllers/authorizations_controller_spec.rb +0 -203
- data/spec/controllers/protected_resources_controller_spec.rb +0 -271
- data/spec/controllers/token_info_controller_spec.rb +0 -52
- data/spec/controllers/tokens_controller_spec.rb +0 -88
- data/spec/dummy/Rakefile +0 -7
- data/spec/dummy/app/controllers/application_controller.rb +0 -3
- data/spec/dummy/app/controllers/custom_authorizations_controller.rb +0 -7
- data/spec/dummy/app/controllers/full_protected_resources_controller.rb +0 -12
- data/spec/dummy/app/controllers/home_controller.rb +0 -17
- data/spec/dummy/app/controllers/metal_controller.rb +0 -11
- data/spec/dummy/app/controllers/semi_protected_resources_controller.rb +0 -11
- data/spec/dummy/app/helpers/application_helper.rb +0 -5
- data/spec/dummy/app/models/user.rb +0 -9
- data/spec/dummy/app/views/home/index.html.erb +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/config/application.rb +0 -57
- data/spec/dummy/config/boot.rb +0 -9
- data/spec/dummy/config/database.yml +0 -15
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -29
- data/spec/dummy/config/environments/production.rb +0 -62
- data/spec/dummy/config/environments/test.rb +0 -55
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/doorkeeper.rb +0 -96
- data/spec/dummy/config/initializers/secret_token.rb +0 -9
- data/spec/dummy/config/initializers/session_store.rb +0 -8
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/doorkeeper.en.yml +0 -5
- data/spec/dummy/config/routes.rb +0 -52
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/db/migrate/20111122132257_create_users.rb +0 -9
- data/spec/dummy/db/migrate/20120312140401_add_password_to_users.rb +0 -5
- data/spec/dummy/db/migrate/20130902165751_create_doorkeeper_tables.rb +0 -41
- data/spec/dummy/db/migrate/20130902175349_add_owner_to_application.rb +0 -7
- data/spec/dummy/db/migrate/20141209001746_add_scopes_to_oauth_applications.rb +0 -5
- data/spec/dummy/db/schema.rb +0 -66
- data/spec/dummy/public/404.html +0 -26
- data/spec/dummy/public/422.html +0 -26
- data/spec/dummy/public/500.html +0 -26
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +0 -6
- data/spec/factories.rb +0 -26
- data/spec/generators/application_owner_generator_spec.rb +0 -22
- data/spec/generators/install_generator_spec.rb +0 -31
- data/spec/generators/migration_generator_spec.rb +0 -20
- data/spec/generators/templates/routes.rb +0 -3
- data/spec/generators/views_generator_spec.rb +0 -27
- data/spec/helpers/doorkeeper/dashboard_helper_spec.rb +0 -24
- data/spec/lib/config_spec.rb +0 -317
- data/spec/lib/doorkeeper_spec.rb +0 -28
- data/spec/lib/models/expirable_spec.rb +0 -51
- data/spec/lib/models/revocable_spec.rb +0 -36
- data/spec/lib/models/scopes_spec.rb +0 -43
- data/spec/lib/oauth/authorization/uri_builder_spec.rb +0 -42
- data/spec/lib/oauth/authorization_code_request_spec.rb +0 -80
- data/spec/lib/oauth/client/credentials_spec.rb +0 -47
- data/spec/lib/oauth/client/methods_spec.rb +0 -54
- data/spec/lib/oauth/client_credentials/creator_spec.rb +0 -44
- data/spec/lib/oauth/client_credentials/issuer_spec.rb +0 -86
- data/spec/lib/oauth/client_credentials/validation_spec.rb +0 -54
- data/spec/lib/oauth/client_credentials_integration_spec.rb +0 -27
- data/spec/lib/oauth/client_credentials_request_spec.rb +0 -104
- data/spec/lib/oauth/client_spec.rb +0 -39
- data/spec/lib/oauth/code_request_spec.rb +0 -45
- data/spec/lib/oauth/error_response_spec.rb +0 -61
- data/spec/lib/oauth/error_spec.rb +0 -23
- data/spec/lib/oauth/forbidden_token_response_spec.rb +0 -23
- data/spec/lib/oauth/helpers/scope_checker_spec.rb +0 -64
- data/spec/lib/oauth/helpers/unique_token_spec.rb +0 -20
- data/spec/lib/oauth/helpers/uri_checker_spec.rb +0 -104
- data/spec/lib/oauth/invalid_token_response_spec.rb +0 -28
- data/spec/lib/oauth/password_access_token_request_spec.rb +0 -90
- data/spec/lib/oauth/pre_authorization_spec.rb +0 -155
- data/spec/lib/oauth/refresh_token_request_spec.rb +0 -123
- data/spec/lib/oauth/scopes_spec.rb +0 -123
- data/spec/lib/oauth/token_request_spec.rb +0 -98
- data/spec/lib/oauth/token_response_spec.rb +0 -85
- data/spec/lib/oauth/token_spec.rb +0 -109
- data/spec/lib/request/strategy_spec.rb +0 -53
- data/spec/lib/server_spec.rb +0 -52
- data/spec/models/doorkeeper/access_grant_spec.rb +0 -36
- data/spec/models/doorkeeper/access_token_spec.rb +0 -350
- data/spec/models/doorkeeper/application_spec.rb +0 -187
- data/spec/requests/applications/applications_request_spec.rb +0 -94
- data/spec/requests/applications/authorized_applications_spec.rb +0 -30
- data/spec/requests/endpoints/authorization_spec.rb +0 -72
- data/spec/requests/endpoints/token_spec.rb +0 -64
- data/spec/requests/flows/authorization_code_errors_spec.rb +0 -66
- data/spec/requests/flows/authorization_code_spec.rb +0 -156
- data/spec/requests/flows/client_credentials_spec.rb +0 -58
- data/spec/requests/flows/implicit_grant_errors_spec.rb +0 -32
- data/spec/requests/flows/implicit_grant_spec.rb +0 -61
- data/spec/requests/flows/password_spec.rb +0 -94
- data/spec/requests/flows/refresh_token_spec.rb +0 -104
- data/spec/requests/flows/revoke_token_spec.rb +0 -143
- data/spec/requests/flows/skip_authorization_spec.rb +0 -59
- data/spec/requests/protected_resources/metal_spec.rb +0 -14
- data/spec/requests/protected_resources/private_api_spec.rb +0 -81
- data/spec/routing/custom_controller_routes_spec.rb +0 -71
- data/spec/routing/default_routes_spec.rb +0 -35
- data/spec/routing/scoped_routes_spec.rb +0 -31
- data/spec/spec_helper.rb +0 -2
- data/spec/spec_helper_integration.rb +0 -56
- data/spec/support/dependencies/factory_girl.rb +0 -2
- data/spec/support/helpers/access_token_request_helper.rb +0 -11
- data/spec/support/helpers/authorization_request_helper.rb +0 -41
- data/spec/support/helpers/config_helper.rb +0 -9
- data/spec/support/helpers/model_helper.rb +0 -45
- data/spec/support/helpers/request_spec_helper.rb +0 -76
- data/spec/support/helpers/url_helper.rb +0 -55
- data/spec/support/orm/active_record.rb +0 -3
- data/spec/support/shared/controllers_shared_context.rb +0 -60
- data/spec/support/shared/models_shared_examples.rb +0 -52
- data/spec/validators/redirect_uri_validator_spec.rb +0 -78
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="
|
1
|
+
<div class="border-bottom mb-4">
|
2
2
|
<h1><%= t('.title') %></h1>
|
3
3
|
</div>
|
4
4
|
|
@@ -9,17 +9,29 @@
|
|
9
9
|
<tr>
|
10
10
|
<th><%= t('.name') %></th>
|
11
11
|
<th><%= t('.callback_url') %></th>
|
12
|
-
<th
|
12
|
+
<th><%= t('.confidential') %></th>
|
13
|
+
<th><%= t('.actions') %></th>
|
13
14
|
<th></th>
|
14
15
|
</tr>
|
15
16
|
</thead>
|
16
17
|
<tbody>
|
17
18
|
<% @applications.each do |application| %>
|
18
19
|
<tr id="application_<%= application.id %>">
|
19
|
-
<td
|
20
|
-
|
21
|
-
|
22
|
-
<td
|
20
|
+
<td class="align-middle">
|
21
|
+
<%= link_to application.name, oauth_application_path(application) %>
|
22
|
+
</td>
|
23
|
+
<td class="align-middle">
|
24
|
+
<%= simple_format(application.redirect_uri) %>
|
25
|
+
</td>
|
26
|
+
<td class="align-middle">
|
27
|
+
<%= application.confidential? ? t('doorkeeper.applications.index.confidentiality.yes') : t('doorkeeper.applications.index.confidentiality.no') %>
|
28
|
+
</td>
|
29
|
+
<td class="align-middle">
|
30
|
+
<%= link_to t('doorkeeper.applications.buttons.edit'), edit_oauth_application_path(application), class: 'btn btn-link' %>
|
31
|
+
</td>
|
32
|
+
<td class="align-middle">
|
33
|
+
<%= render 'delete_form', application: application %>
|
34
|
+
</td>
|
23
35
|
</tr>
|
24
36
|
<% end %>
|
25
37
|
</tbody>
|
@@ -1,32 +1,56 @@
|
|
1
|
-
<div class="
|
1
|
+
<div class="border-bottom mb-4">
|
2
2
|
<h1><%= t('.title', name: @application.name) %></h1>
|
3
3
|
</div>
|
4
4
|
|
5
5
|
<div class="row">
|
6
6
|
<div class="col-md-8">
|
7
7
|
<h4><%= t('.application_id') %>:</h4>
|
8
|
-
<p><code id="application_id"><%= @application.uid %></code></p>
|
8
|
+
<p><code class="bg-light" id="application_id"><%= @application.uid %></code></p>
|
9
9
|
|
10
10
|
<h4><%= t('.secret') %>:</h4>
|
11
|
-
<p
|
11
|
+
<p>
|
12
|
+
<code class="bg-light" id="secret">
|
13
|
+
<% secret = flash[:application_secret].presence || @application.plaintext_secret %>
|
14
|
+
<% if secret.blank? && Doorkeeper.config.application_secret_hashed? %>
|
15
|
+
<span class="bg-light font-italic text-uppercase text-muted"><%= t('.secret_hashed') %></span>
|
16
|
+
<% else %>
|
17
|
+
<%= secret %>
|
18
|
+
<% end %>
|
19
|
+
</code>
|
20
|
+
</p>
|
12
21
|
|
13
22
|
<h4><%= t('.scopes') %>:</h4>
|
14
|
-
<p
|
23
|
+
<p>
|
24
|
+
<code class="bg-light" id="scopes">
|
25
|
+
<% if @application.scopes.present? %>
|
26
|
+
<%= @application.scopes %>
|
27
|
+
<% else %>
|
28
|
+
<span class="bg-light font-italic text-uppercase text-muted"><%= t('.not_defined') %></span>
|
29
|
+
<% end %>
|
30
|
+
</code>
|
31
|
+
</p>
|
32
|
+
|
33
|
+
<h4><%= t('.confidential') %>:</h4>
|
34
|
+
<p><code class="bg-light" id="confidential"><%= @application.confidential? %></code></p>
|
15
35
|
|
16
36
|
<h4><%= t('.callback_urls') %>:</h4>
|
17
37
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<
|
22
|
-
<
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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 %>
|
30
54
|
</div>
|
31
55
|
|
32
56
|
<div class="col-md-4">
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<header class="page-header">
|
2
|
+
<h1><%= t('.title') %></h1>
|
3
|
+
</header>
|
4
|
+
|
5
|
+
<%= form_tag @pre_auth.redirect_uri, method: :post, name: :redirect_form, authenticity_token: false do %>
|
6
|
+
<% @authorize_response.body.compact.each do |key, value| %>
|
7
|
+
<%= hidden_field_tag key, value %>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<script>
|
12
|
+
window.onload = function () {
|
13
|
+
document.forms['redirect_form'].submit();
|
14
|
+
};
|
15
|
+
</script>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
<main role="main">
|
6
6
|
<p class="h4">
|
7
|
-
<%= raw t('.prompt', client_name:
|
7
|
+
<%= raw t('.prompt', client_name: content_tag(:strong, class: 'text-info') { @pre_auth.client.name }) %>
|
8
8
|
</p>
|
9
9
|
|
10
10
|
<% if @pre_auth.scopes.count > 0 %>
|
@@ -21,19 +21,25 @@
|
|
21
21
|
|
22
22
|
<div class="actions">
|
23
23
|
<%= form_tag oauth_authorization_path, method: :post do %>
|
24
|
-
<%= hidden_field_tag :client_id, @pre_auth.client.uid %>
|
25
|
-
<%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri %>
|
26
|
-
<%= hidden_field_tag :state, @pre_auth.state %>
|
27
|
-
<%= hidden_field_tag :response_type, @pre_auth.response_type %>
|
28
|
-
<%= hidden_field_tag :
|
24
|
+
<%= hidden_field_tag :client_id, @pre_auth.client.uid, id: nil %>
|
25
|
+
<%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri, id: nil %>
|
26
|
+
<%= hidden_field_tag :state, @pre_auth.state, id: nil %>
|
27
|
+
<%= hidden_field_tag :response_type, @pre_auth.response_type, id: nil %>
|
28
|
+
<%= hidden_field_tag :response_mode, @pre_auth.response_mode, id: nil %>
|
29
|
+
<%= hidden_field_tag :scope, @pre_auth.scope, id: nil %>
|
30
|
+
<%= hidden_field_tag :code_challenge, @pre_auth.code_challenge, id: nil %>
|
31
|
+
<%= hidden_field_tag :code_challenge_method, @pre_auth.code_challenge_method, id: nil %>
|
29
32
|
<%= submit_tag t('doorkeeper.authorizations.buttons.authorize'), class: "btn btn-success btn-lg btn-block" %>
|
30
33
|
<% end %>
|
31
34
|
<%= form_tag oauth_authorization_path, method: :delete do %>
|
32
|
-
<%= hidden_field_tag :client_id, @pre_auth.client.uid %>
|
33
|
-
<%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri %>
|
34
|
-
<%= hidden_field_tag :state, @pre_auth.state %>
|
35
|
-
<%= hidden_field_tag :response_type, @pre_auth.response_type %>
|
36
|
-
<%= hidden_field_tag :
|
35
|
+
<%= hidden_field_tag :client_id, @pre_auth.client.uid, id: nil %>
|
36
|
+
<%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri, id: nil %>
|
37
|
+
<%= hidden_field_tag :state, @pre_auth.state, id: nil %>
|
38
|
+
<%= hidden_field_tag :response_type, @pre_auth.response_type, id: nil %>
|
39
|
+
<%= hidden_field_tag :response_mode, @pre_auth.response_mode, id: nil %>
|
40
|
+
<%= hidden_field_tag :scope, @pre_auth.scope, id: nil %>
|
41
|
+
<%= hidden_field_tag :code_challenge, @pre_auth.code_challenge, id: nil %>
|
42
|
+
<%= hidden_field_tag :code_challenge_method, @pre_auth.code_challenge_method, id: nil %>
|
37
43
|
<%= submit_tag t('doorkeeper.authorizations.buttons.deny'), class: "btn btn-danger btn-lg btn-block" %>
|
38
44
|
<% end %>
|
39
45
|
</div>
|
@@ -1,5 +1,4 @@
|
|
1
1
|
<%- submit_btn_css ||= 'btn btn-link' %>
|
2
|
-
<%= form_tag oauth_authorized_application_path(application) do %>
|
3
|
-
<input type="hidden" name="_method" value="delete">
|
2
|
+
<%= form_tag oauth_authorized_application_path(application), method: :delete do %>
|
4
3
|
<%= submit_tag t('doorkeeper.authorized_applications.buttons.revoke'), onclick: "return confirm('#{ t('doorkeeper.authorized_applications.confirmations.revoke') }')", class: submit_btn_css %>
|
5
4
|
<% end %>
|
@@ -4,27 +4,29 @@
|
|
4
4
|
<meta charset="utf-8">
|
5
5
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
7
|
-
<title
|
7
|
+
<title><%= t('doorkeeper.layouts.admin.title') %></title>
|
8
8
|
<%= stylesheet_link_tag "doorkeeper/admin/application" %>
|
9
9
|
<%= csrf_meta_tags %>
|
10
10
|
</head>
|
11
11
|
<body>
|
12
|
-
<
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
<%
|
21
|
-
|
22
|
-
|
12
|
+
<nav class="navbar navbar-expand-lg navbar-dark bg-dark mb-5">
|
13
|
+
<%= link_to t('doorkeeper.layouts.admin.nav.oauth2_provider'), oauth_applications_path, class: 'navbar-brand' %>
|
14
|
+
|
15
|
+
<div class="collapse navbar-collapse">
|
16
|
+
<ul class="navbar-nav mr-auto">
|
17
|
+
<li class="nav-item <%= 'active' if request.path == oauth_applications_path %>">
|
18
|
+
<%= link_to t('doorkeeper.layouts.admin.nav.applications'), oauth_applications_path, class: 'nav-link' %>
|
19
|
+
</li>
|
20
|
+
<% if respond_to?(:root_path) %>
|
21
|
+
<li class="nav-item">
|
22
|
+
<%= link_to t('doorkeeper.layouts.admin.nav.home'), root_path, class: 'nav-link' %>
|
23
|
+
</li>
|
23
24
|
<% end %>
|
24
25
|
</ul>
|
25
26
|
</div>
|
26
|
-
</
|
27
|
-
|
27
|
+
</nav>
|
28
|
+
|
29
|
+
<div class="doorkeeper-admin container">
|
28
30
|
<%- if flash[:notice].present? %>
|
29
31
|
<div class="alert alert-info">
|
30
32
|
<%= flash[:notice] %>
|
data/config/locales/en.yml
CHANGED
@@ -11,8 +11,12 @@ 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.'
|
17
|
+
forbidden_uri: 'is forbidden by the server.'
|
18
|
+
scopes:
|
19
|
+
not_match_configured: "doesn't match configured on the server."
|
16
20
|
|
17
21
|
doorkeeper:
|
18
22
|
applications:
|
@@ -27,8 +31,9 @@ en:
|
|
27
31
|
form:
|
28
32
|
error: 'Whoops! Check your form for possible errors'
|
29
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.'
|
30
35
|
redirect_uri: 'Use one line per URI'
|
31
|
-
|
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."
|
32
37
|
scopes: 'Separate scopes with spaces. Leave blank to use the default scopes.'
|
33
38
|
edit:
|
34
39
|
title: 'Edit application'
|
@@ -37,15 +42,23 @@ en:
|
|
37
42
|
new: 'New Application'
|
38
43
|
name: 'Name'
|
39
44
|
callback_url: 'Callback URL'
|
45
|
+
confidential: 'Confidential?'
|
46
|
+
actions: 'Actions'
|
47
|
+
confidentiality:
|
48
|
+
'yes': 'Yes'
|
49
|
+
'no': 'No'
|
40
50
|
new:
|
41
51
|
title: 'New Application'
|
42
52
|
show:
|
43
53
|
title: 'Application: %{name}'
|
44
|
-
application_id: '
|
54
|
+
application_id: 'UID'
|
45
55
|
secret: 'Secret'
|
56
|
+
secret_hashed: 'Secret hashed'
|
46
57
|
scopes: 'Scopes'
|
58
|
+
confidential: 'Confidential'
|
47
59
|
callback_urls: 'Callback urls'
|
48
60
|
actions: 'Actions'
|
61
|
+
not_defined: 'Not defined'
|
49
62
|
|
50
63
|
authorizations:
|
51
64
|
buttons:
|
@@ -59,6 +72,8 @@ en:
|
|
59
72
|
able_to: 'This application will be able to'
|
60
73
|
show:
|
61
74
|
title: 'Authorization code'
|
75
|
+
form_post:
|
76
|
+
title: 'Submit this form'
|
62
77
|
|
63
78
|
authorized_applications:
|
64
79
|
confirmations:
|
@@ -71,36 +86,47 @@ en:
|
|
71
86
|
created_at: 'Created At'
|
72
87
|
date_format: '%Y-%m-%d %H:%M:%S'
|
73
88
|
|
89
|
+
pre_authorization:
|
90
|
+
status: 'Pre-authorization'
|
91
|
+
|
74
92
|
errors:
|
75
93
|
messages:
|
76
94
|
# Common error messages
|
77
|
-
invalid_request:
|
78
|
-
|
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 need to be authorized. Required parameter for authorizing request is missing or invalid.'
|
99
|
+
invalid_redirect_uri: "The requested redirect uri is malformed or doesn't match client redirect URI."
|
79
100
|
unauthorized_client: 'The client is not authorized to perform this request using this method.'
|
80
101
|
access_denied: 'The resource owner or authorization server denied the request.'
|
81
102
|
invalid_scope: 'The requested scope is invalid, unknown, or malformed.'
|
103
|
+
invalid_code_challenge_method: 'The code challenge method must be plain or S256.'
|
82
104
|
server_error: 'The authorization server encountered an unexpected condition which prevented it from fulfilling the request.'
|
83
105
|
temporarily_unavailable: 'The authorization server is currently unable to handle the request due to a temporary overloading or maintenance of the server.'
|
84
106
|
|
85
|
-
#
|
107
|
+
# Configuration error messages
|
86
108
|
credential_flow_not_configured: 'Resource Owner Password Credentials flow failed due to Doorkeeper.configure.resource_owner_from_credentials being unconfigured.'
|
87
|
-
resource_owner_authenticator_not_configured: 'Resource Owner find failed due to Doorkeeper.configure.resource_owner_authenticator being
|
109
|
+
resource_owner_authenticator_not_configured: 'Resource Owner find failed due to Doorkeeper.configure.resource_owner_authenticator being unconfigured.'
|
110
|
+
admin_authenticator_not_configured: 'Access to admin panel is forbidden due to Doorkeeper.configure.admin_authenticator being unconfigured.'
|
88
111
|
|
89
112
|
# Access grant errors
|
90
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.'
|
91
115
|
|
92
116
|
# Access token errors
|
93
117
|
invalid_client: 'Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method.'
|
94
118
|
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.'
|
95
119
|
unsupported_grant_type: 'The authorization grant type is not supported by the authorization server.'
|
96
120
|
|
97
|
-
# Password Access token errors
|
98
|
-
invalid_resource_owner: 'The provided resource owner credentials are not valid, or resource owner cannot be found'
|
99
|
-
|
100
121
|
invalid_token:
|
101
122
|
revoked: "The access token was revoked"
|
102
123
|
expired: "The access token expired"
|
103
124
|
unknown: "The access token is invalid"
|
125
|
+
revoke:
|
126
|
+
unauthorized: "You are not authorized to revoke this token"
|
127
|
+
|
128
|
+
forbidden_token:
|
129
|
+
missing_scope: 'Access to this resource requires scope "%{oauth_scopes}".'
|
104
130
|
|
105
131
|
flash:
|
106
132
|
applications:
|
@@ -116,8 +142,10 @@ en:
|
|
116
142
|
|
117
143
|
layouts:
|
118
144
|
admin:
|
145
|
+
title: 'Doorkeeper'
|
119
146
|
nav:
|
120
147
|
oauth2_provider: 'OAuth2 Provider'
|
121
148
|
applications: 'Applications'
|
149
|
+
home: 'Home'
|
122
150
|
application:
|
123
151
|
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)
|
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,53 @@
|
|
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
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
# Determine whether +reuse_access_token+ and a non-restorable
|
19
|
+
# +token_secret_strategy+ have both been activated.
|
20
|
+
#
|
21
|
+
# In that case, disable reuse_access_token value and warn the user.
|
22
|
+
def validate_reuse_access_token_value
|
23
|
+
strategy = token_secret_strategy
|
24
|
+
return if !reuse_access_token || strategy.allows_restoring_secrets?
|
25
|
+
|
26
|
+
::Rails.logger.warn(
|
27
|
+
"[DOORKEEPER] You have configured both reuse_access_token " \
|
28
|
+
"AND '#{strategy}' strategy which cannot restore tokens. " \
|
29
|
+
"This combination is unsupported. reuse_access_token will be disabled",
|
30
|
+
)
|
31
|
+
@reuse_access_token = false
|
32
|
+
end
|
33
|
+
|
34
|
+
# Validate that the provided strategies are valid for
|
35
|
+
# tokens and applications
|
36
|
+
def validate_secret_strategies
|
37
|
+
token_secret_strategy.validate_for(:token)
|
38
|
+
application_secret_strategy.validate_for(:application)
|
39
|
+
end
|
40
|
+
|
41
|
+
def validate_token_reuse_limit
|
42
|
+
return if !reuse_access_token ||
|
43
|
+
(token_reuse_limit > 0 && token_reuse_limit <= 100)
|
44
|
+
|
45
|
+
::Rails.logger.warn(
|
46
|
+
"[DOORKEEPER] You have configured an invalid value for token_reuse_limit option. " \
|
47
|
+
"It will be set to default 100",
|
48
|
+
)
|
49
|
+
@token_reuse_limit = 100
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|