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,20 @@
|
|
|
1
|
+
Copyright 2011 Applicake. http://applicake.com
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Doorkeeper — awesome OAuth 2 provider for your Rails / Grape app.
|
|
2
|
+
|
|
3
|
+
[](https://rubygems.org/gems/doorkeeper)
|
|
4
|
+
[](https://github.com/doorkeeper-gem/doorkeeper/actions/workflows/ci.yml)
|
|
5
|
+
[](https://qlty.sh/gh/doorkeeper-gem/projects/doorkeeper)
|
|
6
|
+
[](https://coveralls.io/github/doorkeeper-gem/doorkeeper?branch=main)
|
|
7
|
+
[](https://dashboard.guardrails.io/gh/doorkeeper-gem/repos/21183)
|
|
8
|
+
[](https://dependabot.com)
|
|
9
|
+
|
|
10
|
+
Doorkeeper is a gem (Rails engine) that makes it easy to introduce OAuth 2 provider
|
|
11
|
+
functionality to your Ruby on Rails or Grape application.
|
|
12
|
+
|
|
13
|
+
Supported features:
|
|
14
|
+
|
|
15
|
+
- [The OAuth 2.0 Authorization Framework](https://datatracker.ietf.org/doc/html/rfc6749)
|
|
16
|
+
- [Authorization Code Flow](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1)
|
|
17
|
+
- [Access Token Scopes](https://datatracker.ietf.org/doc/html/rfc6749#section-3.3)
|
|
18
|
+
- [Refresh token](https://datatracker.ietf.org/doc/html/rfc6749#section-1.5)
|
|
19
|
+
- [Implicit grant](https://datatracker.ietf.org/doc/html/rfc6749#section-4.2)
|
|
20
|
+
- [Resource Owner Password Credentials](https://datatracker.ietf.org/doc/html/rfc6749#section-4.3)
|
|
21
|
+
- [Client Credentials](https://datatracker.ietf.org/doc/html/rfc6749#section-4.4)
|
|
22
|
+
- [OAuth 2.0 Token Revocation](https://datatracker.ietf.org/doc/html/rfc7009)
|
|
23
|
+
- [OAuth 2.0 Token Introspection](https://datatracker.ietf.org/doc/html/rfc7662)
|
|
24
|
+
- [OAuth 2.0 Threat Model and Security Considerations](https://datatracker.ietf.org/doc/html/rfc6819)
|
|
25
|
+
- [OAuth 2.0 for Native Apps](https://datatracker.ietf.org/doc/html/rfc8252)
|
|
26
|
+
- [Proof Key for Code Exchange by OAuth Public Clients](https://datatracker.ietf.org/doc/html/rfc7636)
|
|
27
|
+
|
|
28
|
+
## Table of Contents
|
|
29
|
+
|
|
30
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
31
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
- [Documentation](#documentation)
|
|
35
|
+
- [Installation](#installation)
|
|
36
|
+
- [Ruby on Rails](#ruby-on-rails)
|
|
37
|
+
- [Grape](#grape)
|
|
38
|
+
- [ORMs](#orms)
|
|
39
|
+
- [Extensions](#extensions)
|
|
40
|
+
- [Example Applications](#example-applications)
|
|
41
|
+
- [Sponsors](#sponsors)
|
|
42
|
+
- [Development](#development)
|
|
43
|
+
- [Contributing](#contributing)
|
|
44
|
+
- [Contributors](#contributors)
|
|
45
|
+
- [License](#license)
|
|
46
|
+
|
|
47
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
48
|
+
|
|
49
|
+
## Documentation
|
|
50
|
+
|
|
51
|
+
This documentation is valid for `main` branch. Please check the documentation for the version of doorkeeper you are using in:
|
|
52
|
+
https://github.com/doorkeeper-gem/doorkeeper/releases.
|
|
53
|
+
|
|
54
|
+
Additionally, other resources can be found on:
|
|
55
|
+
|
|
56
|
+
- [Guides](https://doorkeeper.gitbook.io/guides/) with how-to get started and configuration documentation
|
|
57
|
+
- See the [Wiki](https://github.com/doorkeeper-gem/doorkeeper/wiki) for articles on how to integrate with other solutions
|
|
58
|
+
- Screencast from [railscasts.com](http://railscasts.com/): [#353
|
|
59
|
+
OAuth with
|
|
60
|
+
Doorkeeper](http://railscasts.com/episodes/353-oauth-with-doorkeeper)
|
|
61
|
+
- See [upgrade guides](https://github.com/doorkeeper-gem/doorkeeper/wiki/Migration-from-old-versions)
|
|
62
|
+
- For general questions, please post on [Stack Overflow](http://stackoverflow.com/questions/tagged/doorkeeper)
|
|
63
|
+
- See [SECURITY.md](SECURITY.md) for this project's security disclose
|
|
64
|
+
policy
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
Installation depends on the framework you're using. The first step is to add the following to your Gemfile:
|
|
69
|
+
|
|
70
|
+
```ruby
|
|
71
|
+
gem 'doorkeeper'
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
And run `bundle install`. After this, check out the guide related to the framework you're using.
|
|
75
|
+
|
|
76
|
+
### Ruby on Rails
|
|
77
|
+
|
|
78
|
+
Doorkeeper currently supports Ruby on Rails >= 5.0. See the guide [here](https://doorkeeper.gitbook.io/guides/ruby-on-rails/getting-started).
|
|
79
|
+
|
|
80
|
+
### Grape
|
|
81
|
+
|
|
82
|
+
Guide for integration with Grape framework can be found [here](https://doorkeeper.gitbook.io/guides/grape/grape).
|
|
83
|
+
|
|
84
|
+
## ORMs
|
|
85
|
+
|
|
86
|
+
Doorkeeper supports Active Record by default, but can be configured to work with the following ORMs:
|
|
87
|
+
|
|
88
|
+
| ORM | Support via |
|
|
89
|
+
| :--- | :--- |
|
|
90
|
+
| Active Record | by default |
|
|
91
|
+
| MongoDB | [doorkeeper-gem/doorkeeper-mongodb](https://github.com/doorkeeper-gem/doorkeeper-mongodb) |
|
|
92
|
+
| Sequel | [nbulaj/doorkeeper-sequel](https://github.com/nbulaj/doorkeeper-sequel) |
|
|
93
|
+
| Couchbase | [acaprojects/doorkeeper-couchbase](https://github.com/acaprojects/doorkeeper-couchbase) |
|
|
94
|
+
| RethinkDB | [aca-labs/doorkeeper-rethinkdb](https://github.com/aca-labs/doorkeeper-rethinkdb) |
|
|
95
|
+
|
|
96
|
+
## Extensions
|
|
97
|
+
|
|
98
|
+
Extensions that are not included by default and can be installed separately.
|
|
99
|
+
|
|
100
|
+
| | Link |
|
|
101
|
+
| :--- | :--- |
|
|
102
|
+
| OpenID Connect extension | [doorkeeper-gem/doorkeeper-openid\_connect](https://github.com/doorkeeper-gem/doorkeeper-openid_connect) |
|
|
103
|
+
| JWT Token support | [doorkeeper-gem/doorkeeper-jwt](https://github.com/doorkeeper-gem/doorkeeper-jwt) |
|
|
104
|
+
| Assertion grant extension | [doorkeeper-gem/doorkeeper-grants\_assertion](https://github.com/doorkeeper-gem/doorkeeper-grants_assertion) |
|
|
105
|
+
| I18n translations | [doorkeeper-gem/doorkeeper-i18n](https://github.com/doorkeeper-gem/doorkeeper-i18n) |
|
|
106
|
+
| CIBA - Client Initiated Backchannel Authentication Flow extension | [doorkeeper-ciba](https://github.com/autoseg/doorkeeper-ciba) |
|
|
107
|
+
| Device Authorization Grant | [doorkeeper-device_authorization_grant](https://github.com/exop-group/doorkeeper-device_authorization_grant) |
|
|
108
|
+
|
|
109
|
+
## Example Applications
|
|
110
|
+
|
|
111
|
+
These applications show how Doorkeeper works and how to integrate with it. Start with the oAuth2 server and use the clients to connect with the server.
|
|
112
|
+
|
|
113
|
+
| Application | Link |
|
|
114
|
+
| :--- | :--- |
|
|
115
|
+
| OAuth2 Server with Doorkeeper | [doorkeeper-gem/doorkeeper-provider-app](https://github.com/doorkeeper-gem/doorkeeper-provider-app) |
|
|
116
|
+
| Sinatra Client connected to Provider App | [doorkeeper-gem/doorkeeper-sinatra-client](https://github.com/doorkeeper-gem/doorkeeper-sinatra-client) |
|
|
117
|
+
| Devise + Omniauth Client | [doorkeeper-gem/doorkeeper-devise-client](https://github.com/doorkeeper-gem/doorkeeper-devise-client) |
|
|
118
|
+
|
|
119
|
+
You may want to create a client application to
|
|
120
|
+
test the integration. Check out these [client
|
|
121
|
+
examples](https://github.com/doorkeeper-gem/doorkeeper/wiki/Example-Applications)
|
|
122
|
+
in our wiki or follow this [tutorial
|
|
123
|
+
here](https://github.com/doorkeeper-gem/doorkeeper/wiki/Testing-your-provider-with-OAuth2-gem).
|
|
124
|
+
|
|
125
|
+
## Sponsors
|
|
126
|
+
|
|
127
|
+
[](#backers)
|
|
128
|
+
[](#sponsors)
|
|
129
|
+
|
|
130
|
+
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/doorkeeper-gem#sponsor)]
|
|
131
|
+
|
|
132
|
+
<a href="https://codecademy.com/about/careers?utm_source=doorkeeper-gem" target="_blank"><img src="https://static-assets.codecademy.com/marketing/codecademy_logo_padded.png"/></a>
|
|
133
|
+
|
|
134
|
+
> Codecademy supports open source as part of its mission to democratize tech. Come help us build the education the world deserves: [https://codecademy.com/about/careers](https://codecademy.com/about/careers?utm_source=doorkeeper-gem)
|
|
135
|
+
|
|
136
|
+
<br>
|
|
137
|
+
|
|
138
|
+
<a href="https://oauth.io/?utm_source=doorkeeper-gem" target="_blank"><img src="https://oauth.io/img/logo_text.png"/></a>
|
|
139
|
+
|
|
140
|
+
> 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)
|
|
141
|
+
|
|
142
|
+
<br>
|
|
143
|
+
|
|
144
|
+
<a href="https://www.wealthsimple.com/?utm_source=doorkeeper-gem" target="_blank"><img src="https://wealthsimple.s3.amazonaws.com/branding/medium-black.svg"/></a>
|
|
145
|
+
|
|
146
|
+
> 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)
|
|
147
|
+
|
|
148
|
+
## Development
|
|
149
|
+
|
|
150
|
+
To run the local engine server:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
bundle install
|
|
154
|
+
bundle exec rake doorkeeper:server
|
|
155
|
+
````
|
|
156
|
+
|
|
157
|
+
By default, it uses the latest Rails version with ActiveRecord. To run the
|
|
158
|
+
tests with a specific Rails version:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
BUNDLE_GEMFILE=gemfiles/rails_6_0.gemfile bundle exec rake
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
You can also experiment with the changes using `bin/console`. It uses in-memory SQLite database and default
|
|
165
|
+
Doorkeeper config, but you can reestablish connection or reconfigure the gem if you need.
|
|
166
|
+
|
|
167
|
+
## Contributing
|
|
168
|
+
|
|
169
|
+
Want to contribute and don't know where to start? Check out [features we're
|
|
170
|
+
missing](https://github.com/doorkeeper-gem/doorkeeper/wiki/Supported-Features),
|
|
171
|
+
create [example
|
|
172
|
+
apps](https://github.com/doorkeeper-gem/doorkeeper/wiki/Example-Applications),
|
|
173
|
+
integrate the gem with your app and let us know!
|
|
174
|
+
|
|
175
|
+
Also, check out our [contributing guidelines page](CONTRIBUTING.md).
|
|
176
|
+
|
|
177
|
+
## Contributors
|
|
178
|
+
|
|
179
|
+
Thanks to all our [awesome
|
|
180
|
+
contributors](https://github.com/doorkeeper-gem/doorkeeper/graphs/contributors)!
|
|
181
|
+
|
|
182
|
+
<a href="https://github.com/doorkeeper-gem/doorkeeper/graphs/contributors"><img src="https://opencollective.com/doorkeeper-gem/contributors.svg?width=890&button=false" /></a>
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT License. Created in Applicake. Maintained by the community.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*= require doorkeeper/bootstrap.min
|
|
3
|
+
*
|
|
4
|
+
*= require_self
|
|
5
|
+
*= require_tree .
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
body {
|
|
9
|
+
background-color: #eee;
|
|
10
|
+
font-size: 14px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
#container {
|
|
14
|
+
background-color: #fff;
|
|
15
|
+
border: 1px solid #999;
|
|
16
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
17
|
+
border-radius: 6px;
|
|
18
|
+
-webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
|
|
19
|
+
box-shadow: 0 3px 20px rgba(0, 0, 0, 0.3);
|
|
20
|
+
margin: 2em auto;
|
|
21
|
+
max-width: 600px;
|
|
22
|
+
outline: 0;
|
|
23
|
+
padding: 1em;
|
|
24
|
+
width: 80%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.page-header {
|
|
28
|
+
margin-top: 20px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#oauth-permissions {
|
|
32
|
+
width: 260px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.actions {
|
|
36
|
+
border-top: 1px solid #eee;
|
|
37
|
+
margin-top: 1em;
|
|
38
|
+
padding-top: 9px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.actions > form > .btn {
|
|
42
|
+
margin-top: 5px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.separator {
|
|
46
|
+
color: #eee;
|
|
47
|
+
padding: 0 .5em;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.inline_block {
|
|
51
|
+
display: inline-block;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
#oauth {
|
|
55
|
+
margin-bottom: 1em;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#oauth > .btn {
|
|
59
|
+
width: 7em;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
td {
|
|
63
|
+
vertical-align: middle !important;
|
|
64
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Doorkeeper
|
|
4
|
+
class ApplicationController <
|
|
5
|
+
Doorkeeper.config.resolve_controller(:base)
|
|
6
|
+
include Helpers::Controller
|
|
7
|
+
include ActionController::MimeResponds if Doorkeeper.config.api_only
|
|
8
|
+
|
|
9
|
+
unless Doorkeeper.config.api_only
|
|
10
|
+
protect_from_forgery with: :exception
|
|
11
|
+
helper "doorkeeper/dashboard"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Doorkeeper
|
|
4
|
+
class ApplicationMetalController <
|
|
5
|
+
Doorkeeper.config.resolve_controller(:base_metal)
|
|
6
|
+
include Helpers::Controller
|
|
7
|
+
|
|
8
|
+
before_action :enforce_content_type,
|
|
9
|
+
if: -> { Doorkeeper.config.enforce_content_type }
|
|
10
|
+
|
|
11
|
+
ActiveSupport.run_load_hooks(:doorkeeper_metal_controller, self)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Doorkeeper
|
|
4
|
+
class ApplicationsController < Doorkeeper::ApplicationController
|
|
5
|
+
layout "doorkeeper/admin" unless Doorkeeper.configuration.api_only
|
|
6
|
+
|
|
7
|
+
before_action :authenticate_admin!
|
|
8
|
+
before_action :set_application, only: %i[show edit update destroy]
|
|
9
|
+
|
|
10
|
+
def index
|
|
11
|
+
@applications = Doorkeeper.config.application_model.ordered_by(:created_at)
|
|
12
|
+
|
|
13
|
+
respond_to do |format|
|
|
14
|
+
format.html
|
|
15
|
+
format.json { head :no_content }
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def show
|
|
20
|
+
respond_to do |format|
|
|
21
|
+
format.html
|
|
22
|
+
format.json { render json: @application, as_owner: true }
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def new
|
|
27
|
+
@application = Doorkeeper.config.application_model.new
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def create
|
|
31
|
+
@application = Doorkeeper.config.application_model.new(application_params)
|
|
32
|
+
|
|
33
|
+
if @application.save
|
|
34
|
+
flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])
|
|
35
|
+
flash[:application_secret] = @application.plaintext_secret
|
|
36
|
+
|
|
37
|
+
respond_to do |format|
|
|
38
|
+
format.html { redirect_to oauth_application_url(@application) }
|
|
39
|
+
format.json { render json: @application, as_owner: true }
|
|
40
|
+
end
|
|
41
|
+
else
|
|
42
|
+
respond_to do |format|
|
|
43
|
+
format.html { render :new }
|
|
44
|
+
format.json do
|
|
45
|
+
errors = @application.errors.full_messages
|
|
46
|
+
|
|
47
|
+
render json: { errors: errors }, status: :unprocessable_entity
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def edit; end
|
|
54
|
+
|
|
55
|
+
def update
|
|
56
|
+
if @application.update(application_params)
|
|
57
|
+
flash[:notice] = I18n.t(:notice, scope: i18n_scope(:update))
|
|
58
|
+
|
|
59
|
+
respond_to do |format|
|
|
60
|
+
format.html { redirect_to oauth_application_url(@application) }
|
|
61
|
+
format.json { render json: @application, as_owner: true }
|
|
62
|
+
end
|
|
63
|
+
else
|
|
64
|
+
respond_to do |format|
|
|
65
|
+
format.html { render :edit }
|
|
66
|
+
format.json do
|
|
67
|
+
errors = @application.errors.full_messages
|
|
68
|
+
|
|
69
|
+
render json: { errors: errors }, status: :unprocessable_entity
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def destroy
|
|
76
|
+
flash[:notice] = I18n.t(:notice, scope: i18n_scope(:destroy)) if @application.destroy
|
|
77
|
+
|
|
78
|
+
respond_to do |format|
|
|
79
|
+
format.html { redirect_to oauth_applications_url }
|
|
80
|
+
format.json { head :no_content }
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
private
|
|
85
|
+
|
|
86
|
+
def set_application
|
|
87
|
+
@application = Doorkeeper.config.application_model.find(params[:id])
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def application_params
|
|
91
|
+
params.require(:doorkeeper_application)
|
|
92
|
+
.permit(:name, :redirect_uri, :scopes, :confidential)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def i18n_scope(action)
|
|
96
|
+
%i[doorkeeper flash applications] << action
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Doorkeeper
|
|
4
|
+
class AuthorizationsController < Doorkeeper::ApplicationController
|
|
5
|
+
before_action :authenticate_resource_owner!
|
|
6
|
+
|
|
7
|
+
def new
|
|
8
|
+
if pre_auth.authorizable?
|
|
9
|
+
render_success
|
|
10
|
+
else
|
|
11
|
+
render_error
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def create
|
|
16
|
+
redirect_or_render(authorize_response)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def destroy
|
|
20
|
+
redirect_or_render(authorization.deny)
|
|
21
|
+
rescue Doorkeeper::Errors::InvalidTokenStrategy => e
|
|
22
|
+
error_response = get_error_response_from_exception(e)
|
|
23
|
+
|
|
24
|
+
if Doorkeeper.configuration.api_only
|
|
25
|
+
render json: error_response.body, status: :bad_request
|
|
26
|
+
else
|
|
27
|
+
render :error, locals: { error_response: error_response }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def render_success
|
|
34
|
+
if skip_authorization? || can_authorize_response?
|
|
35
|
+
redirect_or_render(authorize_response)
|
|
36
|
+
elsif Doorkeeper.configuration.api_only
|
|
37
|
+
render json: pre_auth
|
|
38
|
+
else
|
|
39
|
+
render :new
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def render_error
|
|
44
|
+
pre_auth.error_response.raise_exception! if Doorkeeper.config.raise_on_errors?
|
|
45
|
+
|
|
46
|
+
if Doorkeeper.configuration.redirect_on_errors? && pre_auth.error_response.redirectable?
|
|
47
|
+
redirect_or_render(pre_auth.error_response)
|
|
48
|
+
elsif Doorkeeper.configuration.api_only
|
|
49
|
+
render json: pre_auth.error_response.body, status: pre_auth.error_response.status
|
|
50
|
+
else
|
|
51
|
+
render :error, locals: { error_response: pre_auth.error_response }, status: pre_auth.error_response.status
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def can_authorize_response?
|
|
56
|
+
Doorkeeper.config.custom_access_token_attributes.empty? && pre_auth.client.application.confidential? && matching_token?
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Active access token issued for the same client and resource owner with
|
|
60
|
+
# the same set of the scopes exists?
|
|
61
|
+
def matching_token?
|
|
62
|
+
# We don't match tokens on the custom attributes here - we're in the pre-auth here,
|
|
63
|
+
# so they haven't been supplied yet (there are no custom attributes to match on yet)
|
|
64
|
+
@matching_token ||= Doorkeeper.config.access_token_model.matching_token_for(
|
|
65
|
+
pre_auth.client,
|
|
66
|
+
current_resource_owner,
|
|
67
|
+
pre_auth.scopes,
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def redirect_or_render(auth)
|
|
72
|
+
if auth.redirectable?
|
|
73
|
+
if Doorkeeper.configuration.api_only
|
|
74
|
+
if pre_auth.form_post_response?
|
|
75
|
+
render(
|
|
76
|
+
json: { status: :post, redirect_uri: pre_auth.redirect_uri, body: auth.body },
|
|
77
|
+
status: auth.status,
|
|
78
|
+
)
|
|
79
|
+
else
|
|
80
|
+
render(
|
|
81
|
+
json: { status: :redirect, redirect_uri: auth.redirect_uri },
|
|
82
|
+
status: auth.status,
|
|
83
|
+
)
|
|
84
|
+
end
|
|
85
|
+
elsif pre_auth.form_post_response?
|
|
86
|
+
render :form_post, locals: { auth: auth }
|
|
87
|
+
else
|
|
88
|
+
redirect_to auth.redirect_uri, allow_other_host: true
|
|
89
|
+
end
|
|
90
|
+
else
|
|
91
|
+
render json: auth.body, status: auth.status
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def pre_auth
|
|
96
|
+
@pre_auth ||= OAuth::PreAuthorization.new(
|
|
97
|
+
Doorkeeper.configuration,
|
|
98
|
+
pre_auth_params,
|
|
99
|
+
current_resource_owner,
|
|
100
|
+
)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def pre_auth_params
|
|
104
|
+
params.slice(*pre_auth_param_fields).permit(*pre_auth_param_fields)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def pre_auth_param_fields
|
|
108
|
+
custom_access_token_attributes + %i[
|
|
109
|
+
client_id
|
|
110
|
+
code_challenge
|
|
111
|
+
code_challenge_method
|
|
112
|
+
response_type
|
|
113
|
+
response_mode
|
|
114
|
+
redirect_uri
|
|
115
|
+
scope
|
|
116
|
+
state
|
|
117
|
+
]
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def custom_access_token_attributes
|
|
121
|
+
Doorkeeper.config.custom_access_token_attributes.map(&:to_sym)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def authorization
|
|
125
|
+
@authorization ||= strategy.request
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def strategy
|
|
129
|
+
@strategy ||= server.authorization_request(pre_auth.response_type)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def authorize_response
|
|
133
|
+
@authorize_response ||= begin
|
|
134
|
+
unless pre_auth.authorizable?
|
|
135
|
+
response = pre_auth.error_response
|
|
136
|
+
response.raise_exception! if Doorkeeper.config.raise_on_errors?
|
|
137
|
+
return response
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
context = build_context(pre_auth: pre_auth)
|
|
141
|
+
before_successful_authorization(context)
|
|
142
|
+
|
|
143
|
+
auth = strategy.authorize
|
|
144
|
+
|
|
145
|
+
context = build_context(auth: auth)
|
|
146
|
+
after_successful_authorization(context)
|
|
147
|
+
|
|
148
|
+
auth
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def build_context(**attributes)
|
|
153
|
+
Doorkeeper::OAuth::Hooks::Context.new(**attributes)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def before_successful_authorization(context = nil)
|
|
157
|
+
Doorkeeper.config.before_successful_authorization.call(self, context)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def after_successful_authorization(context)
|
|
161
|
+
Doorkeeper.config.after_successful_authorization.call(self, context)
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Doorkeeper
|
|
4
|
+
class AuthorizedApplicationsController < Doorkeeper::ApplicationController
|
|
5
|
+
before_action :authenticate_resource_owner!
|
|
6
|
+
|
|
7
|
+
def index
|
|
8
|
+
@applications = Doorkeeper.config.application_model.authorized_for(current_resource_owner)
|
|
9
|
+
|
|
10
|
+
respond_to do |format|
|
|
11
|
+
format.html
|
|
12
|
+
format.json { render json: @applications, current_resource_owner: current_resource_owner }
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def destroy
|
|
17
|
+
Doorkeeper.config.application_model.revoke_tokens_and_grants_for(
|
|
18
|
+
params[:id],
|
|
19
|
+
current_resource_owner,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
respond_to do |format|
|
|
23
|
+
format.html do
|
|
24
|
+
redirect_to oauth_authorized_applications_url, notice: I18n.t(
|
|
25
|
+
:notice, scope: %i[doorkeeper flash authorized_applications destroy],
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
format.json { head :no_content }
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Doorkeeper
|
|
4
|
+
class TokenInfoController < Doorkeeper::ApplicationMetalController
|
|
5
|
+
def show
|
|
6
|
+
if doorkeeper_token&.accessible?
|
|
7
|
+
render json: doorkeeper_token_to_json, status: :ok
|
|
8
|
+
else
|
|
9
|
+
error = OAuth::InvalidTokenResponse.new
|
|
10
|
+
response.headers.merge!(error.headers)
|
|
11
|
+
render json: error_to_json(error), status: error.status
|
|
12
|
+
end
|
|
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
|
|
24
|
+
end
|
|
25
|
+
end
|