doorkeeper 4.0.0 → 4.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68df4a2a59a456f294e58416fb229932a8ea08c3
4
- data.tar.gz: 30ff755d1ec25a53119b419ad1d0be3a69bedd7d
3
+ metadata.gz: ba5c804bf7f98c343b73a08ddeb8aca3c16e068f
4
+ data.tar.gz: 2b7e888f0adec7f5067bcae28e3b3e2d6d0ade2e
5
5
  SHA512:
6
- metadata.gz: df0bc1f0075ede4a575d2c007806ae887ef11d746204df8bda6345b73abf504911fd8bde1c22e6cbf55066553a3c7f9f10653d127a79ead3c2b5fa204dc9b0d1
7
- data.tar.gz: becadfd542de1ee8c6863f4dcb4a53db12ea737687942f0699519eb5299a7c22ecac9beb8026a9833dd3dd166810cf6bf0213602fa5696def66fefe6cc5dbb38
6
+ metadata.gz: d9945f4ec12a539210541bf179d5ccd3d45d5e9627d7a890d321ba74cb9392913646c0186eeba1cc9b7da143938cc913b47f3295ba53d946c41c203c4bbdd502
7
+ data.tar.gz: 5fb30e9a5d74d6ca628cef571f20ffc51bb648a63aae85b91ec9794a5f5bfe6ea4955286ff64bc087253ca7439b54d46ca3a473113049d125764e4ab9a3bb982
data/NEWS.md CHANGED
@@ -4,6 +4,11 @@ User-visible changes worth mentioning.
4
4
 
5
5
  ## master
6
6
 
7
+ ## 4.1.0
8
+
9
+ - [#845] Allow customising the `Doorkeeper::ApplicationController` base
10
+ controller
11
+
7
12
  ## 4.0.0
8
13
 
9
14
  - [#834] Fix AssetNotPrecompiled error with Sprockets 4
data/README.md CHANGED
@@ -91,11 +91,17 @@ rake db:migrate
91
91
 
92
92
  ### Other ORMs
93
93
 
94
- See [doorkeeper-mongodb project] for mongoid and mongomapper support. Follow along
94
+ See [doorkeeper-mongodb project] for Mongoid and MongoMapper support. Follow along
95
95
  the implementation in that repository to extend doorkeeper with other ORMs.
96
96
 
97
97
  [doorkeeper-mongodb project]: https://github.com/doorkeeper-gem/doorkeeper-mongodb
98
98
 
99
+ If you are using [Sequel gem] then you can add [doorkeeper-sequel extension] to your project.
100
+ Follow configuration instructions for setting up the necessary Doorkeeper ORM.
101
+
102
+ [Sequel gem]: https://github.com/jeremyevans/sequel/
103
+ [doorkeeper-sequel extension]: https://github.com/nbulaj/doorkeeper-sequel
104
+
99
105
  ### Routes
100
106
 
101
107
  The installation script will also automatically add the Doorkeeper routes into
@@ -282,6 +288,16 @@ end
282
288
  JWT token support is available with
283
289
  [Doorkeeper-JWT](https://github.com/chriswarren/doorkeeper-jwt).
284
290
 
291
+ ### Custom Base Controller
292
+
293
+ By default Doorkeeper's main controller `Doorkeeper::ApplicationController` inherits from `ActionController::Base`.
294
+ You may want to use your own controller to inherit from, to keep Doorkeeper controllers in the same context than the rest your app:
295
+
296
+ ```ruby
297
+ Doorkeeper.configure do
298
+ base_controller 'ApplicationController'
299
+ end
300
+ ```
285
301
 
286
302
  ### Authenticated resource owner
287
303
 
@@ -1,5 +1,7 @@
1
1
  module Doorkeeper
2
- class ApplicationController < ActionController::Base
2
+ class ApplicationController <
3
+ Doorkeeper.configuration.base_controller.constantize
4
+
3
5
  include Helpers::Controller
4
6
 
5
7
  if ::Rails.version.to_i < 4
@@ -93,6 +93,10 @@ doorkeeper.
93
93
  '@access_token_generator', access_token_generator
94
94
  )
95
95
  end
96
+
97
+ def base_controller(base_controller)
98
+ @config.instance_variable_set('@base_controller', base_controller)
99
+ end
96
100
  end
97
101
 
98
102
  module Option
@@ -184,7 +188,10 @@ doorkeeper.
184
188
  option :realm, default: 'Doorkeeper'
185
189
  option :force_ssl_in_redirect_uri, default: !Rails.env.development?
186
190
  option :grant_flows, default: %w(authorization_code client_credentials)
187
- option :access_token_generator, default: "Doorkeeper::OAuth::Helpers::UniqueToken"
191
+ option :access_token_generator,
192
+ default: 'Doorkeeper::OAuth::Helpers::UniqueToken'
193
+ option :base_controller,
194
+ default: 'ActionController::Base'
188
195
 
189
196
  attr_reader :reuse_access_token
190
197
 
@@ -1,3 +1,3 @@
1
1
  module Doorkeeper
2
- VERSION = "4.0.0".freeze
2
+ VERSION = "4.1.0".freeze
3
3
  end
@@ -31,7 +31,12 @@ Doorkeeper.configure do
31
31
 
32
32
  # Use a custom class for generating the access token.
33
33
  # https://github.com/doorkeeper-gem/doorkeeper#custom-access-token-generator
34
- # access_token_generator "::Doorkeeper::JWT"
34
+ # access_token_generator '::Doorkeeper::JWT'
35
+
36
+ # The controller Doorkeeper::ApplicationController inherits from.
37
+ # Defaults to ActionController::Base.
38
+ # https://github.com/doorkeeper-gem/doorkeeper#custom-base-controller
39
+ # base_controller 'ApplicationController'
35
40
 
36
41
  # Reuse access token for the same resource owner within an application (disabled by default)
37
42
  # Rationale: https://github.com/doorkeeper-gem/doorkeeper/issues/383
@@ -314,4 +314,21 @@ describe Doorkeeper, 'configuration' do
314
314
  expect(subject.access_token_generator).to eq('Example')
315
315
  end
316
316
  end
317
+
318
+ describe 'base_controller' do
319
+ context 'default' do
320
+ it { expect(Doorkeeper.configuration.base_controller).to eq('ActionController::Base') }
321
+ end
322
+
323
+ context 'custom' do
324
+ before do
325
+ Doorkeeper.configure do
326
+ orm DOORKEEPER_ORM
327
+ base_controller 'ApplicationController'
328
+ end
329
+ end
330
+
331
+ it { expect(Doorkeeper.configuration.base_controller).to eq('ApplicationController') }
332
+ end
333
+ end
317
334
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Elias Philipp
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-01 00:00:00.000000000 Z
12
+ date: 2016-07-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -378,7 +378,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
378
378
  version: '0'
379
379
  requirements: []
380
380
  rubyforge_project:
381
- rubygems_version: 2.6.2
381
+ rubygems_version: 2.5.1
382
382
  signing_key:
383
383
  specification_version: 4
384
384
  summary: OAuth 2 provider for Rails and Grape