doorkeeper 5.0.3 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.hound.yml +2 -1
- data/.rubocop.yml +37 -4
- data/.travis.yml +11 -21
- data/Appraisals +29 -7
- data/Dangerfile +5 -2
- data/Gemfile +19 -5
- data/NEWS.md +81 -21
- data/README.md +75 -485
- data/Rakefile +10 -8
- data/app/controllers/doorkeeper/application_controller.rb +1 -2
- data/app/controllers/doorkeeper/application_metal_controller.rb +2 -13
- data/app/controllers/doorkeeper/applications_controller.rb +20 -8
- data/app/controllers/doorkeeper/authorized_applications_controller.rb +1 -1
- data/app/controllers/doorkeeper/token_info_controller.rb +2 -2
- data/app/controllers/doorkeeper/tokens_controller.rb +11 -11
- data/app/helpers/doorkeeper/dashboard_helper.rb +1 -1
- data/app/validators/redirect_uri_validator.rb +5 -2
- data/app/views/doorkeeper/applications/_form.html.erb +6 -0
- data/app/views/doorkeeper/applications/show.html.erb +1 -1
- data/app/views/layouts/doorkeeper/admin.html.erb +5 -3
- data/bin/console +16 -0
- data/config/locales/en.yml +1 -0
- data/doorkeeper.gemspec +24 -21
- data/gemfiles/rails_5_0.gemfile +9 -4
- data/gemfiles/rails_5_1.gemfile +9 -4
- data/gemfiles/rails_5_2.gemfile +10 -5
- data/gemfiles/rails_6_0.gemfile +17 -0
- data/gemfiles/rails_master.gemfile +9 -9
- data/lib/doorkeeper/config/option.rb +64 -0
- data/lib/doorkeeper/config.rb +191 -75
- data/lib/doorkeeper/engine.rb +1 -1
- data/lib/doorkeeper/grape/authorization_decorator.rb +4 -4
- data/lib/doorkeeper/grape/helpers.rb +3 -3
- data/lib/doorkeeper/helpers/controller.rb +3 -2
- data/lib/doorkeeper/models/access_grant_mixin.rb +20 -3
- data/lib/doorkeeper/models/access_token_mixin.rb +63 -19
- data/lib/doorkeeper/models/application_mixin.rb +43 -1
- data/lib/doorkeeper/models/concerns/expirable.rb +4 -2
- data/lib/doorkeeper/models/concerns/ownership.rb +1 -6
- data/lib/doorkeeper/models/concerns/reusable.rb +19 -0
- data/lib/doorkeeper/models/concerns/revocable.rb +2 -1
- data/lib/doorkeeper/models/concerns/scopes.rb +5 -1
- data/lib/doorkeeper/models/concerns/secret_storable.rb +108 -0
- data/lib/doorkeeper/oauth/authorization/code.rb +2 -2
- data/lib/doorkeeper/oauth/authorization/token.rb +12 -7
- data/lib/doorkeeper/oauth/authorization/uri_builder.rb +1 -1
- data/lib/doorkeeper/oauth/authorization_code_request.rb +6 -4
- data/lib/doorkeeper/oauth/client.rb +1 -1
- data/lib/doorkeeper/oauth/client_credentials/validation.rb +5 -4
- data/lib/doorkeeper/oauth/client_credentials_request.rb +1 -1
- data/lib/doorkeeper/oauth/code_response.rb +2 -2
- data/lib/doorkeeper/oauth/error_response.rb +10 -6
- data/lib/doorkeeper/oauth/forbidden_token_response.rb +1 -1
- data/lib/doorkeeper/oauth/helpers/scope_checker.rb +23 -8
- data/lib/doorkeeper/oauth/helpers/unique_token.rb +13 -1
- data/lib/doorkeeper/oauth/helpers/uri_checker.rb +37 -1
- data/lib/doorkeeper/oauth/invalid_token_response.rb +5 -1
- data/lib/doorkeeper/oauth/password_access_token_request.rb +7 -2
- data/lib/doorkeeper/oauth/pre_authorization.rb +11 -5
- data/lib/doorkeeper/oauth/refresh_token_request.rb +5 -2
- data/lib/doorkeeper/oauth/scopes.rb +5 -3
- data/lib/doorkeeper/oauth/token.rb +2 -2
- data/lib/doorkeeper/oauth/token_introspection.rb +74 -8
- data/lib/doorkeeper/oauth/token_response.rb +9 -9
- data/lib/doorkeeper/oauth.rb +5 -5
- data/lib/doorkeeper/orm/active_record/access_grant.rb +27 -13
- data/lib/doorkeeper/orm/active_record/access_token.rb +6 -13
- data/lib/doorkeeper/orm/active_record/application.rb +21 -57
- data/lib/doorkeeper/orm/active_record/stale_records_cleaner.rb +10 -3
- data/lib/doorkeeper/orm/active_record.rb +6 -6
- data/lib/doorkeeper/rails/helpers.rb +1 -1
- data/lib/doorkeeper/rails/routes/mapping.rb +7 -7
- data/lib/doorkeeper/rails/routes.rb +11 -11
- data/lib/doorkeeper/rake/db.rake +13 -13
- data/lib/doorkeeper/rake.rb +1 -1
- data/lib/doorkeeper/request.rb +1 -1
- 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/stale_records_cleaner.rb +1 -1
- data/lib/doorkeeper/version.rb +3 -3
- data/lib/doorkeeper.rb +69 -60
- data/lib/generators/doorkeeper/application_owner_generator.rb +10 -9
- data/lib/generators/doorkeeper/confidential_applications_generator.rb +10 -9
- data/lib/generators/doorkeeper/install_generator.rb +11 -9
- data/lib/generators/doorkeeper/migration_generator.rb +9 -9
- data/lib/generators/doorkeeper/pkce_generator.rb +10 -9
- data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +10 -9
- data/lib/generators/doorkeeper/templates/initializer.rb +120 -13
- data/lib/generators/doorkeeper/templates/migration.rb.erb +15 -7
- data/lib/generators/doorkeeper/views_generator.rb +6 -4
- data/spec/controllers/application_metal_controller_spec.rb +24 -10
- data/spec/controllers/applications_controller_spec.rb +54 -52
- data/spec/controllers/authorizations_controller_spec.rb +139 -145
- data/spec/controllers/protected_resources_controller_spec.rb +78 -76
- data/spec/controllers/token_info_controller_spec.rb +14 -12
- data/spec/controllers/tokens_controller_spec.rb +167 -108
- data/spec/dummy/Rakefile +3 -1
- data/spec/dummy/app/controllers/application_controller.rb +3 -1
- data/spec/dummy/app/controllers/custom_authorizations_controller.rb +2 -0
- data/spec/dummy/app/controllers/full_protected_resources_controller.rb +4 -2
- data/spec/dummy/app/controllers/home_controller.rb +5 -3
- data/spec/dummy/app/controllers/metal_controller.rb +2 -0
- data/spec/dummy/app/controllers/semi_protected_resources_controller.rb +4 -2
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/user.rb +2 -0
- data/spec/dummy/config/application.rb +25 -1
- data/spec/dummy/config/environments/development.rb +2 -0
- data/spec/dummy/config/environments/production.rb +2 -0
- data/spec/dummy/config/environments/test.rb +3 -1
- data/spec/dummy/config/initializers/backtrace_silencers.rb +2 -0
- data/spec/dummy/config/initializers/doorkeeper.rb +5 -2
- data/spec/dummy/config/initializers/secret_token.rb +3 -1
- data/spec/dummy/config/initializers/session_store.rb +3 -1
- data/spec/dummy/config/initializers/wrap_parameters.rb +2 -0
- data/spec/dummy/config.ru +3 -1
- data/spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb +17 -10
- data/spec/dummy/db/migrate/20170822064514_enable_pkce.rb +2 -0
- data/spec/dummy/db/schema.rb +1 -1
- data/spec/dummy/script/rails +5 -3
- data/spec/factories.rb +8 -6
- data/spec/generators/application_owner_generator_spec.rb +13 -26
- data/spec/generators/confidential_applications_generator_spec.rb +12 -28
- data/spec/generators/install_generator_spec.rb +17 -15
- data/spec/generators/migration_generator_spec.rb +13 -26
- data/spec/generators/pkce_generator_spec.rb +11 -26
- data/spec/generators/previous_refresh_token_generator_spec.rb +16 -29
- data/spec/generators/templates/routes.rb +2 -0
- data/spec/generators/views_generator_spec.rb +14 -12
- data/spec/grape/grape_integration_spec.rb +34 -32
- data/spec/helpers/doorkeeper/dashboard_helper_spec.rb +9 -7
- data/spec/lib/config_spec.rb +268 -99
- data/spec/lib/doorkeeper_spec.rb +3 -1
- data/spec/lib/models/expirable_spec.rb +22 -8
- data/spec/lib/models/reusable_spec.rb +40 -0
- data/spec/lib/models/revocable_spec.rb +8 -6
- data/spec/lib/models/scopes_spec.rb +27 -13
- data/spec/lib/models/secret_storable_spec.rb +135 -0
- data/spec/lib/oauth/authorization/uri_builder_spec.rb +17 -15
- data/spec/lib/oauth/authorization_code_request_spec.rb +34 -11
- data/spec/lib/oauth/base_request_spec.rb +20 -8
- data/spec/lib/oauth/base_response_spec.rb +3 -1
- data/spec/lib/oauth/client/credentials_spec.rb +24 -22
- data/spec/lib/oauth/client_credentials/creator_spec.rb +56 -10
- data/spec/lib/oauth/client_credentials/issuer_spec.rb +27 -18
- data/spec/lib/oauth/client_credentials/validation_spec.rb +20 -15
- data/spec/lib/oauth/client_credentials_integration_spec.rb +7 -5
- data/spec/lib/oauth/client_credentials_request_spec.rb +27 -21
- data/spec/lib/oauth/client_spec.rb +15 -13
- data/spec/lib/oauth/code_request_spec.rb +8 -6
- data/spec/lib/oauth/code_response_spec.rb +9 -7
- data/spec/lib/oauth/error_response_spec.rb +19 -11
- data/spec/lib/oauth/error_spec.rb +4 -2
- data/spec/lib/oauth/forbidden_token_response_spec.rb +7 -5
- data/spec/lib/oauth/helpers/scope_checker_spec.rb +68 -31
- data/spec/lib/oauth/helpers/unique_token_spec.rb +8 -6
- data/spec/lib/oauth/helpers/uri_checker_spec.rb +115 -95
- data/spec/lib/oauth/invalid_token_response_spec.rb +3 -1
- data/spec/lib/oauth/password_access_token_request_spec.rb +79 -30
- data/spec/lib/oauth/pre_authorization_spec.rb +80 -54
- data/spec/lib/oauth/refresh_token_request_spec.rb +36 -33
- data/spec/lib/oauth/scopes_spec.rb +63 -61
- data/spec/lib/oauth/token_request_spec.rb +79 -24
- data/spec/lib/oauth/token_response_spec.rb +40 -38
- data/spec/lib/oauth/token_spec.rb +60 -44
- data/spec/lib/request/strategy_spec.rb +3 -1
- data/spec/lib/secret_storing/base_spec.rb +60 -0
- data/spec/lib/secret_storing/bcrypt_spec.rb +49 -0
- data/spec/lib/secret_storing/plain_spec.rb +44 -0
- data/spec/lib/secret_storing/sha256_hash_spec.rb +48 -0
- data/spec/lib/server_spec.rb +16 -14
- data/spec/lib/stale_records_cleaner_spec.rb +17 -17
- data/spec/models/doorkeeper/access_grant_spec.rb +80 -15
- data/spec/models/doorkeeper/access_token_spec.rb +198 -73
- data/spec/models/doorkeeper/application_spec.rb +280 -288
- data/spec/requests/applications/applications_request_spec.rb +98 -66
- data/spec/requests/applications/authorized_applications_spec.rb +20 -18
- data/spec/requests/endpoints/authorization_spec.rb +25 -23
- data/spec/requests/endpoints/token_spec.rb +38 -36
- data/spec/requests/flows/authorization_code_errors_spec.rb +26 -24
- data/spec/requests/flows/authorization_code_spec.rb +193 -151
- data/spec/requests/flows/client_credentials_spec.rb +54 -52
- data/spec/requests/flows/implicit_grant_errors_spec.rb +10 -8
- data/spec/requests/flows/implicit_grant_spec.rb +27 -25
- data/spec/requests/flows/password_spec.rb +59 -55
- data/spec/requests/flows/refresh_token_spec.rb +45 -43
- data/spec/requests/flows/revoke_token_spec.rb +40 -54
- data/spec/requests/flows/skip_authorization_spec.rb +23 -21
- data/spec/requests/protected_resources/metal_spec.rb +7 -5
- data/spec/requests/protected_resources/private_api_spec.rb +35 -33
- data/spec/routing/custom_controller_routes_spec.rb +71 -65
- data/spec/routing/default_routes_spec.rb +22 -20
- data/spec/routing/scoped_routes_spec.rb +20 -18
- data/spec/spec_helper.rb +15 -13
- data/spec/spec_helper_integration.rb +3 -1
- data/spec/support/dependencies/factory_bot.rb +3 -1
- data/spec/support/doorkeeper_rspec.rb +3 -1
- data/spec/support/helpers/access_token_request_helper.rb +3 -1
- data/spec/support/helpers/authorization_request_helper.rb +4 -2
- data/spec/support/helpers/config_helper.rb +2 -0
- data/spec/support/helpers/model_helper.rb +3 -1
- data/spec/support/helpers/request_spec_helper.rb +5 -3
- data/spec/support/helpers/url_helper.rb +9 -7
- data/spec/support/http_method_shim.rb +4 -9
- data/spec/support/orm/active_record.rb +3 -1
- data/spec/support/shared/controllers_shared_context.rb +18 -16
- data/spec/support/shared/hashing_shared_context.rb +36 -0
- data/spec/support/shared/models_shared_examples.rb +12 -10
- data/spec/validators/redirect_uri_validator_spec.rb +74 -45
- data/spec/version/version_spec.rb +7 -5
- metadata +60 -26
- data/gemfiles/rails_4_2.gemfile +0 -13
- data/spec/dummy/config/initializers/new_framework_defaults.rb +0 -8
data/README.md
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
[](https://coveralls.io/github/doorkeeper-gem/doorkeeper?branch=master)
|
|
7
7
|
[](https://hakiri.io/github/doorkeeper-gem/doorkeeper/master)
|
|
8
8
|
[](https://houndci.com)
|
|
9
|
+
[](https://dashboard.guardrails.io/default/gh/doorkeeper-gem/doorkeeper)
|
|
10
|
+
[](https://dependabot.com)
|
|
9
11
|
|
|
10
12
|
Doorkeeper is a gem (Rails engine) that makes it easy to introduce OAuth 2 provider
|
|
11
13
|
functionality to your Ruby on Rails or Grape application.
|
|
@@ -22,504 +24,117 @@ Supported features:
|
|
|
22
24
|
- [Proof Key for Code Exchange](https://tools.ietf.org/html/rfc7636)
|
|
23
25
|
- [OAuth 2.0 Token Revocation](http://tools.ietf.org/html/rfc7009)
|
|
24
26
|
- [OAuth 2.0 Token Introspection](https://tools.ietf.org/html/rfc7662)
|
|
25
|
-
|
|
26
|
-
See [list of tutorials](https://github.com/doorkeeper-gem/doorkeeper/wiki#how-tos--tutorials) in order to
|
|
27
|
-
learn how to use the gem or integrate it with other solutions / gems.
|
|
28
|
-
|
|
29
|
-
## Documentation valid for `master` branch
|
|
30
|
-
|
|
31
|
-
Please check the documentation for the version of doorkeeper you are using in:
|
|
32
|
-
https://github.com/doorkeeper-gem/doorkeeper/releases
|
|
33
|
-
|
|
34
|
-
- See the [Wiki](https://github.com/doorkeeper-gem/doorkeeper/wiki)
|
|
35
|
-
- See [upgrade guides](https://github.com/doorkeeper-gem/doorkeeper/wiki/Migration-from-old-versions)
|
|
36
|
-
- For general questions, please post in [Stack Overflow](http://stackoverflow.com/questions/tagged/doorkeeper)
|
|
37
|
-
- See [SECURITY.md](SECURITY.md) for this project's security disclose
|
|
38
|
-
policy
|
|
27
|
+
- [OAuth 2.0 Threat Model and Security Considerations](http://tools.ietf.org/html/rfc6819)
|
|
39
28
|
|
|
40
29
|
## Table of Contents
|
|
41
30
|
|
|
42
31
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
43
32
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
44
33
|
|
|
34
|
+
|
|
35
|
+
- [Documentation](#documentation)
|
|
45
36
|
- [Installation](#installation)
|
|
46
|
-
- [
|
|
47
|
-
- [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
- [Routes](#routes)
|
|
54
|
-
- [Authenticating](#authenticating)
|
|
55
|
-
- [Internationalization (I18n)](#internationalization-i18n)
|
|
56
|
-
- [Customizing errors](#customizing-errors)
|
|
57
|
-
- [Rake Tasks](#rake-tasks)
|
|
58
|
-
- [Protecting resources with OAuth (a.k.a your API endpoint)](#protecting-resources-with-oauth-aka-your-api-endpoint)
|
|
59
|
-
- [Ruby on Rails controllers](#ruby-on-rails-controllers)
|
|
60
|
-
- [Grape endpoints](#grape-endpoints)
|
|
61
|
-
- [Route Constraints and other integrations](#route-constraints-and-other-integrations)
|
|
62
|
-
- [Access Token Scopes](#access-token-scopes)
|
|
63
|
-
- [Custom Access Token Generator](#custom-access-token-generator)
|
|
64
|
-
- [Authenticated resource owner](#authenticated-resource-owner)
|
|
65
|
-
- [Applications list](#applications-list)
|
|
66
|
-
- [Other customizations](#other-customizations)
|
|
67
|
-
- [Testing](#testing)
|
|
68
|
-
- [Upgrading](#upgrading)
|
|
37
|
+
- [Ruby on Rails](#ruby-on-rails)
|
|
38
|
+
- [Grape](#grape)
|
|
39
|
+
- [ORMs](#orms)
|
|
40
|
+
- [Extensions](#extensions)
|
|
41
|
+
- [Example Applications](#example-applications)
|
|
42
|
+
- [Tutorials](#tutorials)
|
|
43
|
+
- [Sponsors](#sponsors)
|
|
69
44
|
- [Development](#development)
|
|
70
45
|
- [Contributing](#contributing)
|
|
71
|
-
- [
|
|
72
|
-
|
|
73
|
-
- [Screencast](#screencast)
|
|
74
|
-
- [Client applications](#client-applications)
|
|
75
|
-
- [Contributors](#contributors)
|
|
76
|
-
- [IETF Standards](#ietf-standards)
|
|
77
|
-
- [License](#license)
|
|
46
|
+
- [Contributors](#contributors)
|
|
47
|
+
- [License](#license)
|
|
78
48
|
|
|
79
49
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
80
50
|
|
|
81
|
-
##
|
|
82
|
-
|
|
83
|
-
Put this in your Gemfile:
|
|
84
|
-
|
|
85
|
-
``` ruby
|
|
86
|
-
gem 'doorkeeper'
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Run the installation generator with:
|
|
90
|
-
|
|
91
|
-
rails generate doorkeeper:install
|
|
92
|
-
|
|
93
|
-
This will install the doorkeeper initializer into `config/initializers/doorkeeper.rb`.
|
|
94
|
-
|
|
95
|
-
## Configuration
|
|
96
|
-
|
|
97
|
-
### ORM
|
|
98
|
-
|
|
99
|
-
#### Active Record
|
|
100
|
-
|
|
101
|
-
By default doorkeeper is configured to use Active Record, so to start you have
|
|
102
|
-
to generate the migration tables (supports Rails >= 5 migrations versioning):
|
|
103
|
-
|
|
104
|
-
rails generate doorkeeper:migration
|
|
105
|
-
|
|
106
|
-
You may want to add foreign keys to your migration. For example, if you plan on
|
|
107
|
-
using `User` as the resource owner, add the following line to the migration file
|
|
108
|
-
for each table that includes a `resource_owner_id` column:
|
|
109
|
-
|
|
110
|
-
```ruby
|
|
111
|
-
add_foreign_key :table_name, :users, column: :resource_owner_id
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
If you want to enable [PKCE flow] for mobile apps, you need to generate another
|
|
115
|
-
migration:
|
|
116
|
-
|
|
117
|
-
[PKCE flow]: https://tools.ietf.org/html/rfc7636
|
|
118
|
-
|
|
119
|
-
```sh
|
|
120
|
-
rails generate doorkeeper:pkce
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Then run migrations:
|
|
124
|
-
|
|
125
|
-
```sh
|
|
126
|
-
rake db:migrate
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Ensure to use non-confidential apps for pkce. PKCE is created, because
|
|
130
|
-
you cannot trust its apps' secret. So whatever app needs pkce: it means, it cannot
|
|
131
|
-
be a confidential app by design.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
Remember to add associations to your model so the related records are deleted.
|
|
135
|
-
If you don't do this an `ActiveRecord::InvalidForeignKey`-error will be raised
|
|
136
|
-
when you try to destroy a model with related access grants or access tokens.
|
|
137
|
-
|
|
138
|
-
```ruby
|
|
139
|
-
class User < ApplicationRecord
|
|
140
|
-
has_many :access_grants, class_name: "Doorkeeper::AccessGrant",
|
|
141
|
-
foreign_key: :resource_owner_id,
|
|
142
|
-
dependent: :delete_all # or :destroy if you need callbacks
|
|
143
|
-
|
|
144
|
-
has_many :access_tokens, class_name: "Doorkeeper::AccessToken",
|
|
145
|
-
foreign_key: :resource_owner_id,
|
|
146
|
-
dependent: :delete_all # or :destroy if you need callbacks
|
|
147
|
-
end
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
#### MongoDB
|
|
151
|
-
|
|
152
|
-
See [doorkeeper-mongodb project] for Mongoid and MongoMapper support. Follow along
|
|
153
|
-
the implementation in that repository to extend doorkeeper with other ORMs.
|
|
154
|
-
|
|
155
|
-
[doorkeeper-mongodb project]: https://github.com/doorkeeper-gem/doorkeeper-mongodb
|
|
156
|
-
|
|
157
|
-
#### Sequel
|
|
158
|
-
|
|
159
|
-
If you are using [Sequel gem] then you can add [doorkeeper-sequel extension] to your project.
|
|
160
|
-
Follow configuration instructions for setting up the necessary Doorkeeper ORM.
|
|
161
|
-
|
|
162
|
-
[Sequel gem]: https://github.com/jeremyevans/sequel/
|
|
163
|
-
[doorkeeper-sequel extension]: https://github.com/nbulaj/doorkeeper-sequel
|
|
164
|
-
|
|
165
|
-
#### Couchbase
|
|
166
|
-
|
|
167
|
-
Use [doorkeeper-couchbase] extension if you are using Couchbase database.
|
|
168
|
-
|
|
169
|
-
[doorkeeper-couchbase]: https://github.com/acaprojects/doorkeeper-couchbase
|
|
170
|
-
|
|
171
|
-
### API mode
|
|
172
|
-
|
|
173
|
-
By default Doorkeeper uses full Rails stack to provide all the OAuth 2 functionality
|
|
174
|
-
with additional features like administration area for managing applications. By the
|
|
175
|
-
way, starting from Doorkeeper 5 you can use API mode for your [API only Rails 5 applications](http://edgeguides.rubyonrails.org/api_app.html).
|
|
176
|
-
All you need is just to configure the gem to work in desired mode:
|
|
177
|
-
|
|
178
|
-
``` ruby
|
|
179
|
-
Doorkeeper.configure do
|
|
180
|
-
# ...
|
|
181
|
-
|
|
182
|
-
api_only
|
|
183
|
-
end
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
Keep in mind, that in this mode you will not be able to access `Applications` or
|
|
187
|
-
`Authorized Applications` controllers because they will be skipped. CSRF protections (which are otherwise enabled) will be skipped, and all the redirects will be returned as JSON response with corresponding locations.
|
|
188
|
-
|
|
189
|
-
### Routes
|
|
190
|
-
|
|
191
|
-
The installation script will also automatically add the Doorkeeper routes into
|
|
192
|
-
your app, like this:
|
|
193
|
-
|
|
194
|
-
``` ruby
|
|
195
|
-
Rails.application.routes.draw do
|
|
196
|
-
use_doorkeeper
|
|
197
|
-
# your routes
|
|
198
|
-
end
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
This will mount following routes:
|
|
202
|
-
|
|
203
|
-
GET /oauth/authorize/native?code
|
|
204
|
-
GET /oauth/authorize
|
|
205
|
-
POST /oauth/authorize
|
|
206
|
-
DELETE /oauth/authorize
|
|
207
|
-
POST /oauth/token
|
|
208
|
-
POST /oauth/revoke
|
|
209
|
-
POST /oauth/introspect
|
|
210
|
-
resources /oauth/applications
|
|
211
|
-
GET /oauth/authorized_applications
|
|
212
|
-
DELETE /oauth/authorized_applications/:id
|
|
213
|
-
GET /oauth/token/info
|
|
214
|
-
|
|
215
|
-
For more information on how to customize routes, check out [this page on the
|
|
216
|
-
wiki](https://github.com/doorkeeper-gem/doorkeeper/wiki/Customizing-routes).
|
|
217
|
-
|
|
218
|
-
### Authenticating
|
|
219
|
-
|
|
220
|
-
You need to configure Doorkeeper in order to provide `resource_owner` model
|
|
221
|
-
and authentication block in `config/initializers/doorkeeper.rb`:
|
|
222
|
-
|
|
223
|
-
``` ruby
|
|
224
|
-
Doorkeeper.configure do
|
|
225
|
-
resource_owner_authenticator do
|
|
226
|
-
User.find_by(id: session[:current_user_id]) || redirect_to(login_url)
|
|
227
|
-
end
|
|
228
|
-
end
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
This code is run in the context of your application so you have access to your
|
|
232
|
-
models, session or routes helpers. However, since this code is not run in the
|
|
233
|
-
context of your application's `ApplicationController` it doesn't have access to
|
|
234
|
-
the methods defined over there.
|
|
235
|
-
|
|
236
|
-
You may want to check other ways of authentication
|
|
237
|
-
[here](https://github.com/doorkeeper-gem/doorkeeper/wiki/Authenticating-using-Clearance-or-DIY).
|
|
238
|
-
|
|
239
|
-
### Internationalization (I18n)
|
|
240
|
-
|
|
241
|
-
Doorkeeper support multiple languages. See language files in
|
|
242
|
-
[the I18n repository](https://github.com/doorkeeper-gem/doorkeeper-i18n).
|
|
243
|
-
|
|
244
|
-
### Customizing errors
|
|
245
|
-
|
|
246
|
-
If you don't want to use default Doorkeeper error responses you can raise and rescue it's
|
|
247
|
-
exceptions. All you need is to set configuration option `handle_auth_errors` to `:raise`.
|
|
248
|
-
In this case Doorkeeper will raise `Doorkeeper::Errors::TokenForbidden`,
|
|
249
|
-
`Doorkeeper::Errors::TokenExpired`, `Doorkeeper::Errors::TokenRevoked` or other exceptions
|
|
250
|
-
that you need to care about.
|
|
251
|
-
|
|
252
|
-
### Rake Tasks
|
|
253
|
-
|
|
254
|
-
If you are using `rake`, you can load rake tasks provided by this gem, by adding
|
|
255
|
-
the following line to your `Rakefile`:
|
|
256
|
-
|
|
257
|
-
```ruby
|
|
258
|
-
Doorkeeper::Rake.load_tasks
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
#### Cleaning up
|
|
262
|
-
|
|
263
|
-
By default Doorkeeper is retaining expired and revoked access tokens and grants.
|
|
264
|
-
This allows to keep an audit log of those records, but it also leads to the
|
|
265
|
-
corresponding tables to grow large over the lifetime of your application.
|
|
266
|
-
|
|
267
|
-
If you are concerned about those tables growing too large,
|
|
268
|
-
you can regularly run the following rake task to remove stale entries
|
|
269
|
-
from the database:
|
|
270
|
-
|
|
271
|
-
```rake
|
|
272
|
-
rake doorkeeper:db:cleanup
|
|
273
|
-
```
|
|
51
|
+
## Documentation
|
|
274
52
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
value of each access token **is not considered**. The same is true for access
|
|
278
|
-
grants.
|
|
53
|
+
This documentation is valid for `master` branch. Please check the documentation for the version of doorkeeper you are using in:
|
|
54
|
+
https://github.com/doorkeeper-gem/doorkeeper/releases.
|
|
279
55
|
|
|
280
|
-
|
|
56
|
+
Additionally, other resources can be found on:
|
|
281
57
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
# before_action -> { doorkeeper_authorize! :read, :write }
|
|
293
|
-
|
|
294
|
-
# your actions
|
|
295
|
-
end
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
You can pass any option `before_action` accepts, such as `if`, `only`,
|
|
299
|
-
`except`, and others.
|
|
300
|
-
|
|
301
|
-
### Grape endpoints
|
|
302
|
-
|
|
303
|
-
Starting from version 2.2 Doorkeeper provides helpers for the
|
|
304
|
-
[Grape framework] >= 0.10. One of them is `doorkeeper_authorize!` that
|
|
305
|
-
can be used in a similar way as an example above to protect your API
|
|
306
|
-
with OAuth. Note that you have to use `require 'doorkeeper/grape/helpers'`
|
|
307
|
-
and `helpers Doorkeeper::Grape::Helpers` in your Grape API class.
|
|
308
|
-
|
|
309
|
-
For more information about integration with Grape see the [Wiki].
|
|
310
|
-
|
|
311
|
-
[Grape framework]: https://github.com/ruby-grape/grape
|
|
312
|
-
[Wiki]: https://github.com/doorkeeper-gem/doorkeeper/wiki/Grape-Integration
|
|
313
|
-
|
|
314
|
-
``` ruby
|
|
315
|
-
require 'doorkeeper/grape/helpers'
|
|
316
|
-
|
|
317
|
-
module API
|
|
318
|
-
module V1
|
|
319
|
-
class Users < Grape::API
|
|
320
|
-
helpers Doorkeeper::Grape::Helpers
|
|
321
|
-
|
|
322
|
-
before do
|
|
323
|
-
doorkeeper_authorize!
|
|
324
|
-
end
|
|
325
|
-
|
|
326
|
-
# route_setting :scopes, ['user:email'] - for old versions of Grape
|
|
327
|
-
get :emails, scopes: [:user, :write] do
|
|
328
|
-
[{'email' => current_user.email}]
|
|
329
|
-
end
|
|
330
|
-
|
|
331
|
-
# ...
|
|
332
|
-
end
|
|
333
|
-
end
|
|
334
|
-
end
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
### Route Constraints and other integrations
|
|
338
|
-
|
|
339
|
-
You can leverage the `Doorkeeper.authenticate` facade to easily extract a
|
|
340
|
-
`Doorkeeper::OAuth::Token` based on the current request. You can then ensure
|
|
341
|
-
that token is still good, find its associated `#resource_owner_id`, etc.
|
|
342
|
-
|
|
343
|
-
```ruby
|
|
344
|
-
module Constraint
|
|
345
|
-
class Authenticated
|
|
346
|
-
|
|
347
|
-
def matches?(request)
|
|
348
|
-
token = Doorkeeper.authenticate(request)
|
|
349
|
-
token && token.accessible?
|
|
350
|
-
end
|
|
351
|
-
end
|
|
352
|
-
end
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
For more information about integration and other integrations, check out [the
|
|
356
|
-
related wiki
|
|
357
|
-
page](https://github.com/doorkeeper-gem/doorkeeper/wiki/ActionController::Metal-with-doorkeeper).
|
|
358
|
-
|
|
359
|
-
### Access Token Scopes
|
|
360
|
-
|
|
361
|
-
You can also require the access token to have specific scopes in certain
|
|
362
|
-
actions:
|
|
363
|
-
|
|
364
|
-
First configure the scopes in `initializers/doorkeeper.rb`
|
|
365
|
-
|
|
366
|
-
```ruby
|
|
367
|
-
Doorkeeper.configure do
|
|
368
|
-
default_scopes :public # if no scope was requested, this will be the default
|
|
369
|
-
optional_scopes :admin, :write
|
|
370
|
-
end
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
And in your controllers:
|
|
374
|
-
|
|
375
|
-
```ruby
|
|
376
|
-
class Api::V1::ProductsController < Api::V1::ApiController
|
|
377
|
-
before_action -> { doorkeeper_authorize! :public }, only: :index
|
|
378
|
-
before_action only: [:create, :update, :destroy] do
|
|
379
|
-
doorkeeper_authorize! :admin, :write
|
|
380
|
-
end
|
|
381
|
-
end
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
Please note that there is a logical OR between multiple required scopes. In the
|
|
385
|
-
above example, `doorkeeper_authorize! :admin, :write` means that the access
|
|
386
|
-
token is required to have either `:admin` scope or `:write` scope, but does not
|
|
387
|
-
need to have both of them.
|
|
388
|
-
|
|
389
|
-
If you want to require the access token to have multiple scopes at the same
|
|
390
|
-
time, use multiple `doorkeeper_authorize!`, for example:
|
|
391
|
-
|
|
392
|
-
```ruby
|
|
393
|
-
class Api::V1::ProductsController < Api::V1::ApiController
|
|
394
|
-
before_action -> { doorkeeper_authorize! :public }, only: :index
|
|
395
|
-
before_action only: [:create, :update, :destroy] do
|
|
396
|
-
doorkeeper_authorize! :admin
|
|
397
|
-
doorkeeper_authorize! :write
|
|
398
|
-
end
|
|
399
|
-
end
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
In the above example, a client can call `:create` action only if its access token
|
|
403
|
-
has both `:admin` and `:write` scopes.
|
|
404
|
-
|
|
405
|
-
### Custom Access Token Generator
|
|
406
|
-
|
|
407
|
-
By default a 128 bit access token will be generated. If you require a custom
|
|
408
|
-
token, such as [JWT](http://jwt.io), specify an object that responds to
|
|
409
|
-
`.generate(options = {})` and returns a string to be used as the token.
|
|
410
|
-
|
|
411
|
-
```ruby
|
|
412
|
-
Doorkeeper.configure do
|
|
413
|
-
access_token_generator "Doorkeeper::JWT"
|
|
414
|
-
end
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
JWT token support is available with
|
|
418
|
-
[Doorkeeper-JWT](https://github.com/chriswarren/doorkeeper-jwt).
|
|
58
|
+
- [Guides](https://doorkeeper.gitbook.io/guides/) with how-to get started and configuration documentation
|
|
59
|
+
- See the [Wiki](https://github.com/doorkeeper-gem/doorkeeper/wiki) with articles and other documentation
|
|
60
|
+
- Screencast from [railscasts.com](http://railscasts.com/): [#353
|
|
61
|
+
OAuth with
|
|
62
|
+
Doorkeeper](http://railscasts.com/episodes/353-oauth-with-doorkeeper)
|
|
63
|
+
- See [upgrade guides](https://github.com/doorkeeper-gem/doorkeeper/wiki/Migration-from-old-versions)
|
|
64
|
+
- For general questions, please post on [Stack Overflow](http://stackoverflow.com/questions/tagged/doorkeeper)
|
|
65
|
+
- See [SECURITY.md](SECURITY.md) for this project's security disclose
|
|
66
|
+
policy
|
|
419
67
|
|
|
420
|
-
|
|
68
|
+
## Installation
|
|
421
69
|
|
|
422
|
-
|
|
423
|
-
inherits from `ActionController::Base`. You may want to use your own
|
|
424
|
-
controller to inherit from, to keep Doorkeeper controllers in the same
|
|
425
|
-
context than the rest your app:
|
|
70
|
+
Installation depends on the framework you're using. The first step is to add the following to your Gemfile:
|
|
426
71
|
|
|
427
72
|
```ruby
|
|
428
|
-
|
|
429
|
-
base_controller 'ApplicationController'
|
|
430
|
-
end
|
|
73
|
+
gem 'doorkeeper'
|
|
431
74
|
```
|
|
432
75
|
|
|
433
|
-
|
|
76
|
+
And run `bundle install`. After this, check out the guide related to the framework you're using.
|
|
434
77
|
|
|
435
|
-
|
|
436
|
-
words, the access token owner, you may want to define a method in your
|
|
437
|
-
controller that returns the resource owner instance:
|
|
78
|
+
### Ruby on Rails
|
|
438
79
|
|
|
439
|
-
|
|
440
|
-
class Api::V1::CredentialsController < Api::V1::ApiController
|
|
441
|
-
before_action :doorkeeper_authorize!
|
|
442
|
-
respond_to :json
|
|
80
|
+
Doorkeeper currently supports Ruby on Rails >= 5.0. See the guide [here](https://doorkeeper.gitbook.io/guides/ruby-on-rails/getting-started).
|
|
443
81
|
|
|
444
|
-
|
|
445
|
-
def me
|
|
446
|
-
respond_with current_resource_owner
|
|
447
|
-
end
|
|
82
|
+
### Grape
|
|
448
83
|
|
|
449
|
-
|
|
84
|
+
Guide for integration with Grape framework can be found [here](https://doorkeeper.gitbook.io/guides/grape/grape).
|
|
450
85
|
|
|
451
|
-
|
|
452
|
-
def current_resource_owner
|
|
453
|
-
User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token
|
|
454
|
-
end
|
|
455
|
-
end
|
|
456
|
-
```
|
|
86
|
+
## ORMs
|
|
457
87
|
|
|
458
|
-
|
|
459
|
-
token owner.
|
|
88
|
+
Doorkeeper supports Active Record by default, but can be configured to work with the following ORMs:
|
|
460
89
|
|
|
461
|
-
|
|
90
|
+
| ORM | Support via |
|
|
91
|
+
| :--- | :--- |
|
|
92
|
+
| Active Record | by default |
|
|
93
|
+
| MongoDB | [doorkeeper-gem/doorkeeper-mongodb](https://github.com/doorkeeper-gem/doorkeeper-mongodb) |
|
|
94
|
+
| Sequel | [nbulaj/doorkeeper-sequel](https://github.com/nbulaj/doorkeeper-sequel) |
|
|
95
|
+
| Couchbase | [acaprojects/doorkeeper-couchbase](https://github.com/acaprojects/doorkeeper-couchbase) |
|
|
462
96
|
|
|
463
|
-
|
|
464
|
-
Starting from Doorkeeper 5.0 it returns 403 Forbidden if `admin_authenticator` option is not configured
|
|
465
|
-
by developers.
|
|
97
|
+
## Extensions
|
|
466
98
|
|
|
467
|
-
|
|
99
|
+
Extensions that are not included by default and can be installed separately.
|
|
468
100
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
end
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
The logic is the same as the `resource_owner_authenticator` block. **Note:**
|
|
479
|
-
since the application list is just a scaffold, it's recommended to either
|
|
480
|
-
customize the controller used by the list or skip the controller all together.
|
|
481
|
-
For more information see the page
|
|
482
|
-
[in the wiki](https://github.com/doorkeeper-gem/doorkeeper/wiki/Customizing-routes).
|
|
101
|
+
| | Link |
|
|
102
|
+
| :--- | :--- |
|
|
103
|
+
| OpenID Connect extension | [doorkeeper-gem/doorkeeper-openid\_connect](https://github.com/doorkeeper-gem/doorkeeper-openid_connect) |
|
|
104
|
+
| JWT Token support | [doorkeeper-gem/doorkeeper-jwt](https://github.com/doorkeeper-gem/doorkeeper-jwt) |
|
|
105
|
+
| Assertion grant extension | [doorkeeper-gem/doorkeeper-grants\_assertion](https://github.com/doorkeeper-gem/doorkeeper-grants_assertion) |
|
|
106
|
+
| I18n translations | [doorkeeper-gem/doorkeeper-i18n](https://github.com/doorkeeper-gem/doorkeeper-i18n) |
|
|
483
107
|
|
|
484
|
-
|
|
485
|
-
you can enforce users to create applications only with configured scopes
|
|
486
|
-
(`default_scopes` and `optional_scopes` from the Doorkeeper initializer):
|
|
108
|
+
## Example Applications
|
|
487
109
|
|
|
488
|
-
|
|
489
|
-
# config/initializers/doorkeeper.rb
|
|
490
|
-
Doorkeeper.configure do
|
|
491
|
-
# ...
|
|
110
|
+
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.
|
|
492
111
|
|
|
493
|
-
|
|
494
|
-
|
|
112
|
+
| Application | Link |
|
|
113
|
+
| :--- | :--- |
|
|
114
|
+
| oAuth2 Server with Doorkeeper | [doorkeeper-gem/doorkeeper-provider-app](https://github.com/doorkeeper-gem/doorkeeper-provider-app) |
|
|
115
|
+
| Sinatra Client connected to Provider App | [doorkeeper-gem/doorkeeper-sinatra-client](https://github.com/doorkeeper-gem/doorkeeper-sinatra-client) |
|
|
116
|
+
| Devise + Omniauth Client | [doorkeeper-gem/doorkeeper-devise-client](https://github.com/doorkeeper-gem/doorkeeper-devise-client) |
|
|
495
117
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
118
|
+
You may want to create a client application to
|
|
119
|
+
test the integration. Check out these [client
|
|
120
|
+
examples](https://github.com/doorkeeper-gem/doorkeeper/wiki/Example-Applications)
|
|
121
|
+
in our wiki or follow this [tutorial
|
|
122
|
+
here](https://github.com/doorkeeper-gem/doorkeeper/wiki/Testing-your-provider-with-OAuth2-gem).
|
|
499
123
|
|
|
500
|
-
##
|
|
124
|
+
## Tutorials
|
|
501
125
|
|
|
502
|
-
|
|
503
|
-
- [CORS - Cross Origin Resource Sharing](https://github.com/doorkeeper-gem/doorkeeper/wiki/%5BCORS%5D-Cross-Origin-Resource-Sharing)
|
|
504
|
-
- see more on [Wiki page](https://github.com/doorkeeper-gem/doorkeeper/wiki)
|
|
126
|
+
See [list of tutorials](https://github.com/doorkeeper-gem/doorkeeper/wiki#how-tos--tutorials) in order to learn how to use the gem or integrate it with other solutions / gems.
|
|
505
127
|
|
|
506
|
-
##
|
|
128
|
+
## Sponsors
|
|
507
129
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
to load models. There are [known issue](https://github.com/doorkeeper-gem/doorkeeper/issues/1043)
|
|
511
|
-
with the `factory_bot_rails` gem (it executes factories building before `ActiveRecord::Base`
|
|
512
|
-
is initialized using hooks in gem railtie, so you can catch a `uninitialized constant` error).
|
|
513
|
-
It is recommended to use pure `factory_bot` gem to solve this problem.
|
|
130
|
+
[](#backers)
|
|
131
|
+
[](#sponsors)
|
|
514
132
|
|
|
515
|
-
|
|
133
|
+
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)]
|
|
516
134
|
|
|
517
|
-
|
|
518
|
-
notes](https://github.com/doorkeeper-gem/doorkeeper/wiki/Migration-from-old-versions)
|
|
519
|
-
and take a look at the
|
|
520
|
-
[changelog](https://github.com/doorkeeper-gem/doorkeeper/blob/master/NEWS.md).
|
|
135
|
+
<a href="https://oauth.io/?utm_source=doorkeeper-gem" target="_blank"><img src="https://oauth.io/img/logo_text.png"/></a>
|
|
521
136
|
|
|
522
|
-
|
|
137
|
+
> 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)
|
|
523
138
|
|
|
524
139
|
## Development
|
|
525
140
|
|
|
@@ -534,7 +149,7 @@ By default, it uses the latest Rails version with ActiveRecord. To run the
|
|
|
534
149
|
tests with a specific ORM and Rails version:
|
|
535
150
|
|
|
536
151
|
```
|
|
537
|
-
rails=
|
|
152
|
+
rails=5.2 orm=active_record bundle exec rake
|
|
538
153
|
```
|
|
539
154
|
|
|
540
155
|
## Contributing
|
|
@@ -548,38 +163,13 @@ integrate the gem with your app and let us know!
|
|
|
548
163
|
Also, check out our [contributing guidelines
|
|
549
164
|
page](https://github.com/doorkeeper-gem/doorkeeper/wiki/Contributing).
|
|
550
165
|
|
|
551
|
-
##
|
|
552
|
-
|
|
553
|
-
### Wiki
|
|
554
|
-
|
|
555
|
-
You can find everything about Doorkeeper in our [wiki
|
|
556
|
-
here](https://github.com/doorkeeper-gem/doorkeeper/wiki).
|
|
557
|
-
|
|
558
|
-
### Screencast
|
|
559
|
-
|
|
560
|
-
Check out this screencast from [railscasts.com](http://railscasts.com/): [#353
|
|
561
|
-
OAuth with
|
|
562
|
-
Doorkeeper](http://railscasts.com/episodes/353-oauth-with-doorkeeper)
|
|
563
|
-
|
|
564
|
-
### Client applications
|
|
565
|
-
|
|
566
|
-
After you set up the provider, you may want to create a client application to
|
|
567
|
-
test the integration. Check out these [client
|
|
568
|
-
examples](https://github.com/doorkeeper-gem/doorkeeper/wiki/Example-Applications)
|
|
569
|
-
in our wiki or follow this [tutorial
|
|
570
|
-
here](https://github.com/doorkeeper-gem/doorkeeper/wiki/Testing-your-provider-with-OAuth2-gem).
|
|
571
|
-
|
|
572
|
-
### Contributors
|
|
166
|
+
## Contributors
|
|
573
167
|
|
|
574
168
|
Thanks to all our [awesome
|
|
575
169
|
contributors](https://github.com/doorkeeper-gem/doorkeeper/graphs/contributors)!
|
|
576
170
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
* [The OAuth 2.0 Authorization Framework](http://tools.ietf.org/html/rfc6749)
|
|
580
|
-
* [OAuth 2.0 Threat Model and Security Considerations](http://tools.ietf.org/html/rfc6819)
|
|
581
|
-
* [OAuth 2.0 Token Revocation](http://tools.ietf.org/html/rfc7009)
|
|
171
|
+
<a href="https://github.com/doorkeeper-gem/doorkeeper/graphs/contributors"><img src="https://opencollective.com/doorkeeper-gem/contributors.svg?width=890&button=false" /></a>
|
|
582
172
|
|
|
583
|
-
|
|
173
|
+
## License
|
|
584
174
|
|
|
585
175
|
MIT License. Copyright 2011 Applicake.
|
data/Rakefile
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
require 'rspec/core/rake_task'
|
|
1
|
+
# frozen_string_literal: true
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "rspec/core/rake_task"
|
|
5
|
+
|
|
6
|
+
desc "Default: run specs."
|
|
5
7
|
task default: :spec
|
|
6
8
|
|
|
7
9
|
desc "Run all specs"
|
|
@@ -12,14 +14,14 @@ end
|
|
|
12
14
|
namespace :doorkeeper do
|
|
13
15
|
desc "Install doorkeeper in dummy app"
|
|
14
16
|
task :install do
|
|
15
|
-
cd
|
|
16
|
-
system
|
|
17
|
+
cd "spec/dummy"
|
|
18
|
+
system "bundle exec rails g doorkeeper:install --force"
|
|
17
19
|
end
|
|
18
20
|
|
|
19
|
-
desc
|
|
21
|
+
desc "Runs local test server"
|
|
20
22
|
task :server do
|
|
21
|
-
cd
|
|
22
|
-
system
|
|
23
|
+
cd "spec/dummy"
|
|
24
|
+
system "bundle exec rails server"
|
|
23
25
|
end
|
|
24
26
|
end
|
|
25
27
|
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
module Doorkeeper
|
|
4
4
|
class ApplicationController <
|
|
5
5
|
Doorkeeper.configuration.base_controller.constantize
|
|
6
|
-
|
|
7
6
|
include Helpers::Controller
|
|
8
7
|
|
|
9
8
|
unless Doorkeeper.configuration.api_only
|
|
10
9
|
protect_from_forgery with: :exception
|
|
11
|
-
helper
|
|
10
|
+
helper "doorkeeper/dashboard"
|
|
12
11
|
end
|
|
13
12
|
end
|
|
14
13
|
end
|