doorkeeper 2.0.0.alpha1 → 2.0.0.rc2

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.

Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +38 -10
  3. data/CHANGELOG.md +25 -7
  4. data/CONTRIBUTING.md +35 -0
  5. data/Gemfile +3 -25
  6. data/README.md +1 -14
  7. data/Rakefile +3 -1
  8. data/app/controllers/doorkeeper/authorizations_controller.rb +4 -2
  9. data/app/validators/redirect_uri_validator.rb +6 -0
  10. data/config/locales/en.yml +3 -0
  11. data/doorkeeper.gemspec +3 -3
  12. data/gemfiles/Gemfile.common.rb +11 -0
  13. data/gemfiles/Gemfile.mongo_mapper.rb +5 -0
  14. data/gemfiles/Gemfile.mongoid2.rb +5 -0
  15. data/gemfiles/Gemfile.mongoid3.rb +4 -0
  16. data/gemfiles/Gemfile.mongoid4.rb +5 -0
  17. data/lib/doorkeeper/config.rb +6 -1
  18. data/lib/doorkeeper/models/application_mixin.rb +18 -0
  19. data/lib/doorkeeper/oauth/pre_authorization.rb +5 -1
  20. data/lib/doorkeeper/oauth/scopes.rb +6 -1
  21. data/lib/doorkeeper/orm/mongoid2/application.rb +1 -0
  22. data/lib/doorkeeper/orm/mongoid3/application.rb +1 -0
  23. data/lib/doorkeeper/orm/mongoid4/application.rb +1 -0
  24. data/lib/doorkeeper/version.rb +1 -1
  25. data/lib/generators/doorkeeper/application_owner_generator.rb +4 -1
  26. data/lib/generators/doorkeeper/application_scopes_generator.rb +34 -0
  27. data/lib/generators/doorkeeper/templates/add_scopes_to_oauth_applications.rb +5 -0
  28. data/lib/generators/doorkeeper/templates/initializer.rb +6 -0
  29. data/lib/generators/doorkeeper/templates/migration.rb +1 -0
  30. data/lib/generators/doorkeeper/views_generator.rb +4 -5
  31. data/spec/controllers/applications_controller_spec.rb +3 -3
  32. data/spec/controllers/tokens_controller_spec.rb +15 -9
  33. data/spec/dummy/app/models/user.rb +5 -5
  34. data/spec/dummy/config/application.rb +1 -1
  35. data/spec/dummy/config/boot.rb +4 -1
  36. data/spec/dummy/db/migrate/20141209001746_add_scopes_to_oauth_applications.rb +5 -0
  37. data/spec/dummy/db/schema.rb +41 -40
  38. data/spec/factories.rb +24 -0
  39. data/spec/lib/config_spec.rb +14 -0
  40. data/spec/lib/oauth/client_spec.rb +1 -1
  41. data/spec/lib/oauth/pre_authorization_spec.rb +43 -9
  42. data/spec/models/doorkeeper/application_spec.rb +15 -0
  43. data/spec/requests/applications/applications_request_spec.rb +3 -1
  44. data/spec/spec_helper_integration.rb +3 -1
  45. data/spec/validators/redirect_uri_validator_spec.rb +30 -3
  46. metadata +18 -10
  47. data/spec/factories/access_grant.rb +0 -9
  48. data/spec/factories/access_token.rb +0 -11
  49. data/spec/factories/application.rb +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4bc922834f77e390385c6b9ff4284dc7f68cf0b
4
- data.tar.gz: 23f9d1f65f3fe87e7c5f603d6b107230e142b79a
3
+ metadata.gz: 210e4fe74a245228a17d33cee59e3ca0b623cf6f
4
+ data.tar.gz: d639da9ead08dc48b5dbe89837bd086e909e14c0
5
5
  SHA512:
6
- metadata.gz: 494114035eb4172c2ade7e380566e5e28707348a54c71d396028dac19fd4a6746c1f5f1272e916921cda0faa8f22bec6900e3af649fc0ae720bc39671ef63b28
7
- data.tar.gz: 0288945e46c7b2b90db5a7e75e3db6405331c1dd2830cf46f88ef2154d139530dc60f7ed587c2f2bc56078645d89a64bb7b1efeaf0ce24b2bc96807a27062170
6
+ metadata.gz: 9e01e9c004ced7e97eef6920c963fbb27c7fa7e3179c2bd00df7a3474c7e0185409cb029d1f2854ea66288f8d16fc27afc8d3bd50c548e37abb77cfbbcdad97b
7
+ data.tar.gz: 1516f21f124320f14516e5167fb498075105e3453f683465fe08953b44e779d5d7e68fb7ca3f5a97b9db7e822e1bf151ac81813c45d0932d00cacc1bb1faa0eb
data/.travis.yml CHANGED
@@ -1,18 +1,46 @@
1
1
  language: ruby
2
+ sudo: false
3
+ cache: bundler
4
+
2
5
  rvm:
3
6
  - 1.9.3
4
7
  - 2.0
5
8
  - 2.1
9
+
6
10
  env:
7
- - rails=3.1.12
8
- - rails=3.2.18
9
- - rails=4.0.5
10
- - rails=4.1.1
11
- - orm=mongoid2
12
- - orm=mongoid3
13
- - orm=mongoid4
14
- - orm=mongo_mapper
15
- - table_name_prefix=h_
16
- - table_name_suffix=_h
11
+ # - rails=3.1 # Don't need it in the CI matrix
12
+ - rails=3.2.0
13
+ - rails=4.0.0
14
+ - rails=4.1.0
15
+ - rails=4.2.0.rc2
16
+
17
+ gemfile:
18
+ - Gemfile
19
+ - gemfiles/Gemfile.mongoid2.rb
20
+ - gemfiles/Gemfile.mongoid3.rb
21
+ - gemfiles/Gemfile.mongoid4.rb
22
+ - gemfiles/Gemfile.mongo_mapper.rb
23
+
17
24
  services:
18
25
  - mongodb
26
+
27
+ matrix:
28
+ exclude:
29
+ - gemfile: gemfiles/Gemfile.mongoid2.rb
30
+ env: rails=4.0.0
31
+ - gemfile: gemfiles/Gemfile.mongoid2.rb
32
+ env: rails=4.1.0
33
+ - gemfile: gemfiles/Gemfile.mongoid2.rb
34
+ env: rails=4.2.0.rc2
35
+
36
+ - gemfile: gemfiles/Gemfile.mongoid3.rb
37
+ env: rails=4.0.0
38
+ - gemfile: gemfiles/Gemfile.mongoid3.rb
39
+ env: rails=4.1.0
40
+ - gemfile: gemfiles/Gemfile.mongoid3.rb
41
+ env: rails=4.2.0.rc2
42
+
43
+ - gemfile: gemfiles/Gemfile.mongoid4.rb
44
+ env: rails=3.1.0
45
+ - gemfile: gemfiles/Gemfile.mongoid4.rb
46
+ env: rails=3.2.0
data/CHANGELOG.md CHANGED
@@ -1,14 +1,28 @@
1
1
  # Changelog
2
2
 
3
- ## master (preparation for 2.0.0)
3
+ ## 2.0.0
4
+
5
+ ### Backward incompatible changes
4
6
 
5
- - Removes deprecated option `test_redirect_uri`. Now called
6
- `native_redirect_uri`.
7
- - [#446] Removes deprecated `mount Doorkeeper::Engine`. Now we use
8
- `use_doorkeeper`.
9
7
  - [#448] Removes `doorkeeper_for` helper. Now we use
10
- `before_action :doorkeeper_authorize!`. This change didn't go through the
11
- deprecation cycle.
8
+ `before_action :doorkeeper_authorize!`.
9
+ - [#469] Allow client applications to restrict the set of allowable scopes.
10
+ Fixes #317. `oauth_applications` relation needs a new `scopes` string column,
11
+ non nullable, which defaults to an empty string. Run `rails generate
12
+ doorkeeper:application_scopes` to add the column. If you’d rather do it by
13
+ hand, your ActiveRecord migration should contain:
14
+
15
+ ```ruby
16
+ add_column :oauth_applications, :scopes, :string, null: false, default: ‘’
17
+ ```
18
+
19
+ ### Removed deprecations
20
+
21
+ - Removes `test_redirect_uri` option. It is now called `native_redirect_uri`.
22
+ - [#446] Removes `mount Doorkeeper::Engine`. Now we use `use_doorkeeper`.
23
+
24
+ ### Other changes/enhancements
25
+
12
26
  - [#450] When password is invalid in Password Credentials Grant, Doorkeeper
13
27
  returned 'invalid_resource_owner' instead of 'invalid_grant', as the spec
14
28
  declares. Fixes #444.
@@ -18,6 +32,10 @@
18
32
  - [#491] Reworks of @jasl's #454 and #478. ORM refactor that allows doorkeeper
19
33
  to be extended more easily with unsupported ORMs. It also marks the boundaries
20
34
  between shared model code and ORM specifics inside of the gem.
35
+ - [#496] Tests with Rails 4.2.
36
+ - [#489] Adds `force_ssl_in_redirect_uri` to force the usage of the HTTPS
37
+ protocol in non-native redirect uris.
38
+
21
39
 
22
40
  ## 1.4.0
23
41
 
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,35 @@
1
+ # Contributing
2
+
3
+ We love pull requests. Here's a quick guide.
4
+
5
+ Fork, then clone the repo:
6
+
7
+ git clone git@github.com:your-username/doorkeeper.git
8
+
9
+ Set up Ruby dependencies via Bundler
10
+
11
+ bundle install
12
+
13
+ Make sure the tests pass:
14
+
15
+ rake
16
+
17
+ Make your change. Add tests for your change. Make the tests pass:
18
+
19
+ rake
20
+
21
+ Push to your fork and submit a pull request.
22
+
23
+ At this point you're waiting on us. We like to at least comment on pull requests
24
+ within three business days (and, typically, one business day). We may suggest
25
+ some changes or improvements or alternatives.
26
+
27
+ Some things that will increase the chance that your pull request is accepted:
28
+
29
+ * Write tests.
30
+ * Follow our [style guide][style]. Address Hound CI comments unless you have a
31
+ good reason not to.
32
+ * Write a [good commit message][commit].
33
+
34
+ [style]: https://github.com/thoughtbot/guides/tree/master/style
35
+ [commit]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
data/Gemfile CHANGED
@@ -1,33 +1,11 @@
1
- # Defaults. For supported versions check .travis.yml
2
- ENV['rails'] ||= ENV['orm'] == "mongoid4" ? '4.1.0' : '3.2.0'
3
- ENV['orm'] ||= 'active_record'
1
+ ENV['rails'] ||= '4.2.0.rc2'
4
2
 
5
3
  source 'https://rubygems.org'
6
4
 
7
- # Define Rails version
8
5
  gem 'rails', "~> #{ENV['rails']}"
9
6
 
10
- gem 'database_cleaner' if ENV['rails'][0] == '4'
11
-
12
- case ENV['orm']
13
- when 'active_record'
14
- gem 'activerecord'
15
-
16
- when 'mongoid2'
17
- gem 'mongoid', '~> 2'
18
- gem 'bson_ext', '~> 1.7'
19
-
20
- when 'mongoid3'
21
- gem 'mongoid', '~> 3'
22
-
23
- when 'mongoid4'
24
- gem 'mongoid', '~> 4'
25
- gem 'moped'
26
-
27
- when 'mongo_mapper'
28
- gem 'mongo_mapper', '~> 0.12'
29
- gem 'bson_ext', '~> 1.7'
30
-
7
+ if ENV['rails'][0] == '4'
8
+ gem 'database_cleaner'
31
9
  end
32
10
 
33
11
  gemspec
data/README.md CHANGED
@@ -151,20 +151,7 @@ models, session or routes helpers. However, since this code is not run in the
151
151
  context of your application's `ApplicationController` it doesn't have access to
152
152
  the methods defined over there.
153
153
 
154
- If you use [devise](https://github.com/plataformatec/devise), you may want to
155
- use warden to authenticate the block:
156
-
157
- ``` ruby
158
- resource_owner_authenticator do
159
- current_user || warden.authenticate!(:scope => :user)
160
- end
161
- ```
162
-
163
- Side note: when using devise you have access to `current_user` as devise extends
164
- entire `ActionController::Base` with the `current_#{mapping}`.
165
-
166
- If you are not using devise, you may want to check other ways of
167
- authentication
154
+ You may want to check other ways of authentication
168
155
  [here](https://github.com/doorkeeper-gem/doorkeeper/wiki/Authenticating-using-Clearance-or-DIY).
169
156
 
170
157
  ## Protecting resources with OAuth (a.k.a your API endpoint)
data/Rakefile CHANGED
@@ -5,7 +5,9 @@ desc 'Default: run specs.'
5
5
  task :default => :spec
6
6
 
7
7
  desc "Run all specs"
8
- RSpec::Core::RakeTask.new(:spec)
8
+ RSpec::Core::RakeTask.new(:spec) do |config|
9
+ config.verbose = false
10
+ end
9
11
 
10
12
  namespace :doorkeeper do
11
13
  desc "Install doorkeeper in dummy app"
@@ -4,7 +4,7 @@ module Doorkeeper
4
4
 
5
5
  def new
6
6
  if pre_auth.authorizable?
7
- if matching_token? || skip_authorization?
7
+ if skip_authorization? || matching_token?
8
8
  auth = authorization.authorize
9
9
  redirect_to auth.redirect_uri
10
10
  else
@@ -41,7 +41,9 @@ module Doorkeeper
41
41
  end
42
42
 
43
43
  def pre_auth
44
- @pre_auth ||= OAuth::PreAuthorization.new(Doorkeeper.configuration, server.client_via_uid, params)
44
+ @pre_auth ||= OAuth::PreAuthorization.new(Doorkeeper.configuration,
45
+ server.client_via_uid,
46
+ params)
45
47
  end
46
48
 
47
49
  def authorization
@@ -14,6 +14,7 @@ class RedirectUriValidator < ActiveModel::EachValidator
14
14
  return if native_redirect_uri?(uri)
15
15
  record.errors.add(attribute, :fragment_present) unless uri.fragment.nil?
16
16
  record.errors.add(attribute, :relative_uri) if uri.scheme.nil? || uri.host.nil?
17
+ record.errors.add(attribute, :secured_uri) if invalid_ssl_uri?(uri)
17
18
  end
18
19
  end
19
20
  rescue URI::InvalidURIError
@@ -25,4 +26,9 @@ class RedirectUriValidator < ActiveModel::EachValidator
25
26
  def native_redirect_uri?(uri)
26
27
  self.class.native_redirect_uri.present? && uri.to_s == self.class.native_redirect_uri.to_s
27
28
  end
29
+
30
+ def invalid_ssl_uri?(uri)
31
+ forces_ssl = Doorkeeper.configuration.force_ssl_in_redirect_uri
32
+ forces_ssl && uri.try(:scheme) != 'https'
33
+ end
28
34
  end
@@ -8,6 +8,7 @@ en:
8
8
  fragment_present: 'cannot contain a fragment.'
9
9
  invalid_uri: 'must be a valid URI.'
10
10
  relative_uri: 'must be an absolute URI.'
11
+ secured_uri: 'must be an HTTPS/SSL URI.'
11
12
  mongoid:
12
13
  errors:
13
14
  models:
@@ -17,6 +18,7 @@ en:
17
18
  fragment_present: 'cannot contain a fragment.'
18
19
  invalid_uri: 'must be a valid URI.'
19
20
  relative_uri: 'must be an absolute URI.'
21
+ secured_uri: 'must be an HTTPS/SSL URI.'
20
22
  mongo_mapper:
21
23
  errors:
22
24
  models:
@@ -26,6 +28,7 @@ en:
26
28
  fragment_present: 'cannot contain a fragment.'
27
29
  invalid_uri: 'must be a valid URI.'
28
30
  relative_uri: 'must be an absolute URI.'
31
+ secured_uri: 'must be an HTTPS/SSL URI.'
29
32
  doorkeeper:
30
33
  errors:
31
34
  messages:
data/doorkeeper.gemspec CHANGED
@@ -5,8 +5,8 @@ require "doorkeeper/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "doorkeeper"
7
7
  s.version = Doorkeeper::VERSION
8
- s.authors = ["Felipe Elias Philipp", "Piotr Jakubowski"]
9
- s.email = ["felipe@applicake.com", "piotr.jakubowski@applicake.com"]
8
+ s.authors = ["Felipe Elias Philipp", "Tute Costa"]
9
+ s.email = %w(tutecosta@gmail.com)
10
10
  s.homepage = "https://github.com/doorkeeper-gem/doorkeeper"
11
11
  s.summary = "Doorkeeper is an OAuth 2 provider for Rails."
12
12
  s.description = "Doorkeeper is an OAuth 2 provider for Rails."
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.add_development_dependency "rspec-rails", "~> 2.99.0"
23
23
  s.add_development_dependency "capybara", "~> 2.3.0"
24
24
  s.add_development_dependency "generator_spec", "~> 0.9.0"
25
- s.add_development_dependency "factory_girl", "~> 4.4.0"
25
+ s.add_development_dependency "factory_girl", "~> 4.5.0"
26
26
  s.add_development_dependency "timecop", "~> 0.7.0"
27
27
  s.add_development_dependency "database_cleaner", "~> 1.3.0"
28
28
  s.add_development_dependency "rspec-activemodel-mocks", "~> 1.0.0"
@@ -0,0 +1,11 @@
1
+ ENV['rails'] ||= '4.2.0.rc2'
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'rails', "~> #{ENV['rails']}"
6
+
7
+ if ENV['rails'][0] == '4'
8
+ gem 'database_cleaner'
9
+ end
10
+
11
+ gemspec path: '../'
@@ -0,0 +1,5 @@
1
+ gemfile = 'gemfiles/Gemfile.common.rb'
2
+ instance_eval IO.read(gemfile), gemfile
3
+
4
+ gem 'mongo_mapper', '~> 0.12'
5
+ gem 'bson_ext', '~> 1.7'
@@ -0,0 +1,5 @@
1
+ gemfile = 'gemfiles/Gemfile.common.rb'
2
+ instance_eval IO.read(gemfile), gemfile
3
+
4
+ gem 'mongoid', '~> 2'
5
+ gem 'bson_ext', '~> 1.7'
@@ -0,0 +1,4 @@
1
+ gemfile = 'gemfiles/Gemfile.common.rb'
2
+ instance_eval IO.read(gemfile), gemfile
3
+
4
+ gem 'mongoid', '~> 3'
@@ -0,0 +1,5 @@
1
+ gemfile = 'gemfiles/Gemfile.common.rb'
2
+ instance_eval IO.read(gemfile), gemfile
3
+
4
+ gem 'mongoid', '~> 4'
5
+ gem 'moped'
@@ -87,6 +87,10 @@ and that your `initialize_models!` method doesn't raise any errors.\n
87
87
  def reuse_access_token
88
88
  @config.instance_variable_set("@reuse_access_token", true)
89
89
  end
90
+
91
+ def force_ssl_in_redirect_uri(boolean)
92
+ @config.instance_variable_set("@force_ssl_in_redirect_uri", boolean)
93
+ end
90
94
  end
91
95
 
92
96
  module Option
@@ -174,6 +178,7 @@ and that your `initialize_models!` method doesn't raise any errors.\n
174
178
  option :active_record_options, default: {}
175
179
  option :realm, default: 'Doorkeeper'
176
180
  option :wildcard_redirect_uri, default: false
181
+ option :force_ssl_in_redirect_uri, default: !Rails.env.development?
177
182
  option :grant_flows,
178
183
  default: %w(authorization_code implicit password client_credentials)
179
184
 
@@ -204,7 +209,7 @@ and that your `initialize_models!` method doesn't raise any errors.\n
204
209
  end
205
210
 
206
211
  def orm_name
207
- [:mongoid2, :mongoid3, :mongoid4].include?(orm) ? :mongoid : orm
212
+ [:mongoid2, :mongoid3, :mongoid4].include?(orm.to_sym) ? :mongoid : orm
208
213
  end
209
214
 
210
215
  def client_credentials_methods
@@ -3,6 +3,7 @@ module Doorkeeper
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  include OAuth::Helpers
6
+ include Models::Scopes
6
7
 
7
8
  included do
8
9
  has_many :access_grants, dependent: :destroy, class_name: 'Doorkeeper::AccessGrant'
@@ -29,8 +30,25 @@ module Doorkeeper
29
30
  end
30
31
  end
31
32
 
33
+ alias_method :original_scopes, :scopes
34
+ def scopes
35
+ if has_scopes?
36
+ original_scopes
37
+ else
38
+ fail NameError, "Missing column: `applications.scopes`.", <<-MSG.squish
39
+ If you are using ActiveRecord run `rails generate doorkeeper:application_scopes
40
+ && rake db:migrate` to add it.
41
+ MSG
42
+ end
43
+ end
44
+
32
45
  private
33
46
 
47
+ def has_scopes?
48
+ Doorkeeper.configuration.orm != :active_record ||
49
+ Application.new.attributes.include?("scopes")
50
+ end
51
+
34
52
  def generate_uid
35
53
  self.uid ||= UniqueToken.generate
36
54
  end
@@ -48,7 +48,11 @@ module Doorkeeper
48
48
 
49
49
  def validate_scopes
50
50
  return true unless scope.present?
51
- Helpers::ScopeChecker.valid? scope, server.scopes
51
+ if client.application.scopes.empty?
52
+ Helpers::ScopeChecker.valid?(scope, server.scopes)
53
+ else
54
+ Helpers::ScopeChecker.valid?(scope, server.scopes & client.application.scopes)
55
+ end
52
56
  end
53
57
 
54
58
  # TODO: test uri should be matched against the client's one
@@ -17,7 +17,7 @@ module Doorkeeper
17
17
  end
18
18
  end
19
19
 
20
- delegate :each, to: :@scopes
20
+ delegate :each, :empty?, to: :@scopes
21
21
 
22
22
  def initialize
23
23
  @scopes = []
@@ -55,6 +55,11 @@ module Doorkeeper
55
55
  def <=>(other)
56
56
  self.map(&:to_s).sort <=> other.map(&:to_s).sort
57
57
  end
58
+
59
+ def &(other)
60
+ other_array = other.present? ? other.all : []
61
+ self.class.from_array(all & other_array)
62
+ end
58
63
  end
59
64
  end
60
65
  end
@@ -2,6 +2,7 @@ module Doorkeeper
2
2
  class Application
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
+ include Models::Mongoid2::Scopes
5
6
 
6
7
  include ApplicationMixin
7
8
 
@@ -2,6 +2,7 @@ module Doorkeeper
2
2
  class Application
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
+ include Models::Mongoid3::Scopes
5
6
 
6
7
  include ApplicationMixin
7
8
 
@@ -2,6 +2,7 @@ module Doorkeeper
2
2
  class Application
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
+ include Models::Mongoid4::Scopes
5
6
 
6
7
  include ApplicationMixin
7
8
 
@@ -1,3 +1,3 @@
1
1
  module Doorkeeper
2
- VERSION = '2.0.0.alpha1'
2
+ VERSION = '2.0.0.rc2'
3
3
  end
@@ -6,7 +6,10 @@ class Doorkeeper::ApplicationOwnerGenerator < Rails::Generators::Base
6
6
  desc 'Provide support for client application ownership.'
7
7
 
8
8
  def application_owner
9
- migration_template 'add_owner_to_application_migration.rb', 'db/migrate/add_owner_to_application.rb'
9
+ migration_template(
10
+ 'add_owner_to_application_migration.rb',
11
+ 'db/migrate/add_owner_to_application.rb'
12
+ )
10
13
  end
11
14
 
12
15
  def self.next_migration_number(dirname)
@@ -0,0 +1,34 @@
1
+ require 'rails/generators/active_record'
2
+
3
+ class Doorkeeper::ApplicationScopesGenerator < Rails::Generators::Base
4
+ include Rails::Generators::Migration
5
+ source_root File.expand_path('../templates', __FILE__)
6
+ desc 'Copies ActiveRecord migrations to handle upgrade to doorkeeper 2'
7
+
8
+ def self.next_migration_number(path)
9
+ ActiveRecord::Generators::Base.next_migration_number(path)
10
+ end
11
+
12
+ def application_scopes
13
+ if oauth_applications_exists? && !scopes_column_exists?
14
+ migration_template(
15
+ 'add_scopes_to_oauth_applications.rb',
16
+ 'db/migrate/add_scopes_to_oauth_applications.rb'
17
+ )
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def scopes_column_exists?
24
+ ActiveRecord::Base.connection.column_exists?(
25
+ :oauth_applications,
26
+ :scopes
27
+ )
28
+ end
29
+
30
+ # Might be running this before install
31
+ def oauth_applications_exists?
32
+ ActiveRecord::Base.connection.table_exists? :oauth_applications
33
+ end
34
+ end
@@ -0,0 +1,5 @@
1
+ class AddScopesToOauthApplications < ActiveRecord::Migration
2
+ def change
3
+ add_column :oauth_applications, :scopes, :string, null: false, default: ''
4
+ end
5
+ end
@@ -64,6 +64,12 @@ Doorkeeper.configure do
64
64
  #
65
65
  # native_redirect_uri 'urn:ietf:wg:oauth:2.0:oob'
66
66
 
67
+ # Forces the usage of the HTTPS protocol in non-native redirect uris (enabled
68
+ # by default in non-development environments). OAuth2 delegates security in
69
+ # communication to the HTTPS protocol so it is wise to keep this enabled.
70
+ #
71
+ # force_ssl_in_redirect_uri !Rails.env.development?
72
+
67
73
  # Specify what grant flows are enabled in array of Strings. The valid
68
74
  # strings and the flows they enable are:
69
75
  #
@@ -5,6 +5,7 @@ class CreateDoorkeeperTables < ActiveRecord::Migration
5
5
  t.string :uid, null: false
6
6
  t.string :secret, null: false
7
7
  t.text :redirect_uri, null: false
8
+ t.string :scopes, null: false, default: ''
8
9
  t.timestamps
9
10
  end
10
11
 
@@ -1,14 +1,13 @@
1
1
  module Doorkeeper
2
2
  module Generators
3
3
  class ViewsGenerator < ::Rails::Generators::Base
4
- source_root File.expand_path('../../../../app/views/doorkeeper', __FILE__)
4
+ source_root File.expand_path('../../../../app/views', __FILE__)
5
5
 
6
- desc 'Copies default Doorkeeper views to your application.'
6
+ desc 'Copies default Doorkeeper views and layouts to your application.'
7
7
 
8
8
  def manifest
9
- directory 'applications', 'app/views/doorkeeper/applications'
10
- directory 'authorizations', 'app/views/doorkeeper/authorizations'
11
- directory 'authorized_applications', 'app/views/doorkeeper/authorized_applications'
9
+ directory 'doorkeeper', 'app/views/doorkeeper'
10
+ directory 'layouts/doorkeeper', 'app/views/layouts/doorkeeper'
12
11
  end
13
12
  end
14
13
  end
@@ -18,7 +18,7 @@ module Doorkeeper
18
18
  expect do
19
19
  post :create, doorkeeper_application: {
20
20
  name: 'Example',
21
- redirect_uri: 'http://example.com' }
21
+ redirect_uri: 'https://example.com' }
22
22
  end.to_not change { Doorkeeper::Application.count }
23
23
  end
24
24
  end
@@ -32,7 +32,7 @@ module Doorkeeper
32
32
  expect do
33
33
  post :create, doorkeeper_application: {
34
34
  name: 'Example',
35
- redirect_uri: 'http://example.com' }
35
+ redirect_uri: 'https://example.com' }
36
36
  end.to change { Doorkeeper::Application.count }.by(1)
37
37
  expect(response).to be_redirect
38
38
  end
@@ -50,7 +50,7 @@ module Doorkeeper
50
50
  application = FactoryGirl.create(:application)
51
51
  put :update, id: application.id, doorkeeper_application: {
52
52
  name: 'Example',
53
- redirect_uri: 'http://example.com' }
53
+ redirect_uri: 'https://example.com' }
54
54
  expect(application.reload.name).to eq 'Example'
55
55
  end
56
56
  end
@@ -18,20 +18,26 @@ describe Doorkeeper::TokensController do
18
18
  end
19
19
 
20
20
  describe 'when authorization has failed' do
21
- let :token do
22
- double(:token, authorize: false)
23
- end
24
-
25
- before do
21
+ it 'returns the error response' do
22
+ token = double(:token, authorize: false)
26
23
  allow(controller).to receive(:token) { token }
27
- end
28
24
 
29
- it 'returns the error response' do
30
- skip 'verify need of these specs'
31
- allow(token).to receive(:error_response).and_return(double(to_json: [], status: :unauthorized))
32
25
  post :create
26
+
33
27
  expect(response.status).to eq 401
34
28
  expect(response.headers['WWW-Authenticate']).to match(/Bearer/)
35
29
  end
36
30
  end
31
+
32
+ describe 'when revoke authorization has failed' do
33
+ # http://tools.ietf.org/html/rfc7009#section-2.2
34
+ it 'returns no error response' do
35
+ token = double(:token, authorize: false)
36
+ allow(controller).to receive(:token) { token }
37
+
38
+ post :revoke
39
+
40
+ expect(response.status).to eq 200
41
+ end
42
+ end
37
43
  end
@@ -1,8 +1,8 @@
1
- case DOORKEEPER_ORM
2
- when :active_record
1
+ case DOORKEEPER_ORM.to_s
2
+ when "active_record"
3
3
  class User < ActiveRecord::Base
4
4
  end
5
- when :mongoid2, :mongoid3, :mongoid4
5
+ when /mongoid/
6
6
  class User
7
7
  include Mongoid::Document
8
8
  include Mongoid::Timestamps
@@ -10,7 +10,7 @@ when :mongoid2, :mongoid3, :mongoid4
10
10
  field :name, type: String
11
11
  field :password, type: String
12
12
  end
13
- when :mongo_mapper
13
+ when "mongo_mapper"
14
14
  class User
15
15
  include MongoMapper::Document
16
16
  timestamps!
@@ -21,7 +21,7 @@ when :mongo_mapper
21
21
  end
22
22
 
23
23
  class User
24
- if ::Rails.version.to_i < 4
24
+ if ::Rails.version.to_i < 4 || defined?(::ProtectedAttributes)
25
25
  attr_accessible :name, :password
26
26
  end
27
27
 
@@ -5,7 +5,7 @@ require 'sprockets/railtie'
5
5
 
6
6
  Bundler.require :default
7
7
 
8
- orm = if [:mongoid2, :mongoid3, :mongoid4].include?(DOORKEEPER_ORM)
8
+ orm = if DOORKEEPER_ORM =~ /mongoid/
9
9
  Mongoid.load!(File.join(File.dirname(File.expand_path(__FILE__)), "#{DOORKEEPER_ORM}.yml"))
10
10
  :mongoid
11
11
  else
@@ -1,6 +1,9 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
 
4
- DOORKEEPER_ORM = (ENV['orm'] || :active_record).to_sym unless defined?(DOORKEEPER_ORM)
4
+ orm = ENV['BUNDLE_GEMFILE'].match(/Gemfile\.(.+)\.rb/)
5
+ unless defined?(DOORKEEPER_ORM)
6
+ DOORKEEPER_ORM = (orm && orm[1]) || :active_record
7
+ end
5
8
 
6
9
  $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,5 @@
1
+ class AddScopesToOauthApplications < ActiveRecord::Migration
2
+ def change
3
+ add_column :oauth_applications, :scopes, :string, null: false, default: ''
4
+ end
5
+ end
@@ -9,57 +9,58 @@
9
9
  # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
10
  # you'll amass, the slower it'll run and the greater likelihood for issues).
11
11
  #
12
- # It's strongly recommended to check this file into your version control system.
12
+ # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20130902175349) do
14
+ ActiveRecord::Schema.define(version: 20141209001746) do
15
15
 
16
- create_table 'oauth_access_grants', force: true do |t|
17
- t.integer 'resource_owner_id', null: false
18
- t.integer 'application_id', null: false
19
- t.string 'token', null: false
20
- t.integer 'expires_in', null: false
21
- t.text 'redirect_uri', null: false
22
- t.datetime 'created_at', null: false
23
- t.datetime 'revoked_at'
24
- t.string 'scopes'
16
+ create_table "oauth_access_grants", force: true do |t|
17
+ t.integer "resource_owner_id", null: false
18
+ t.integer "application_id", null: false
19
+ t.string "token", null: false
20
+ t.integer "expires_in", null: false
21
+ t.string "redirect_uri", limit: 2048, null: false
22
+ t.datetime "created_at", null: false
23
+ t.datetime "revoked_at"
24
+ t.string "scopes"
25
25
  end
26
26
 
27
- add_index 'oauth_access_grants', ['token'], name: 'index_oauth_access_grants_on_token', unique: true
27
+ add_index "oauth_access_grants", ["token"], name: "index_oauth_access_grants_on_token", unique: true
28
28
 
29
- create_table 'oauth_access_tokens', force: true do |t|
30
- t.integer 'resource_owner_id'
31
- t.integer 'application_id'
32
- t.string 'token', null: false
33
- t.string 'refresh_token'
34
- t.integer 'expires_in'
35
- t.datetime 'revoked_at'
36
- t.datetime 'created_at', null: false
37
- t.string 'scopes'
29
+ create_table "oauth_access_tokens", force: true do |t|
30
+ t.integer "resource_owner_id"
31
+ t.integer "application_id"
32
+ t.string "token", null: false
33
+ t.string "refresh_token"
34
+ t.integer "expires_in"
35
+ t.datetime "revoked_at"
36
+ t.datetime "created_at", null: false
37
+ t.string "scopes"
38
38
  end
39
39
 
40
- add_index 'oauth_access_tokens', ['refresh_token'], name: 'index_oauth_access_tokens_on_refresh_token', unique: true
41
- add_index 'oauth_access_tokens', ['resource_owner_id'], name: 'index_oauth_access_tokens_on_resource_owner_id'
42
- add_index 'oauth_access_tokens', ['token'], name: 'index_oauth_access_tokens_on_token', unique: true
40
+ add_index "oauth_access_tokens", ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true
41
+ add_index "oauth_access_tokens", ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id"
42
+ add_index "oauth_access_tokens", ["token"], name: "index_oauth_access_tokens_on_token", unique: true
43
43
 
44
- create_table 'oauth_applications', force: true do |t|
45
- t.string 'name', null: false
46
- t.string 'uid', null: false
47
- t.string 'secret', null: false
48
- t.text 'redirect_uri', null: false
49
- t.datetime 'created_at', null: false
50
- t.datetime 'updated_at', null: false
51
- t.integer 'owner_id'
52
- t.string 'owner_type'
44
+ create_table "oauth_applications", force: true do |t|
45
+ t.string "name", null: false
46
+ t.string "uid", null: false
47
+ t.string "secret", null: false
48
+ t.string "redirect_uri", limit: 2048, null: false
49
+ t.datetime "created_at", null: false
50
+ t.datetime "updated_at", null: false
51
+ t.integer "owner_id"
52
+ t.string "owner_type"
53
+ t.string "scopes", default: "", null: false
53
54
  end
54
55
 
55
- add_index 'oauth_applications', %w(owner_id owner_type), name: 'index_oauth_applications_on_owner_id_and_owner_type'
56
- add_index 'oauth_applications', ['uid'], name: 'index_oauth_applications_on_uid', unique: true
56
+ add_index "oauth_applications", ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type"
57
+ add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true
57
58
 
58
- create_table 'users', force: true do |t|
59
- t.string 'name'
60
- t.datetime 'created_at', null: false
61
- t.datetime 'updated_at', null: false
62
- t.string 'password'
59
+ create_table "users", force: true do |t|
60
+ t.string "name"
61
+ t.datetime "created_at", null: false
62
+ t.datetime "updated_at", null: false
63
+ t.string "password"
63
64
  end
64
65
 
65
66
  end
data/spec/factories.rb ADDED
@@ -0,0 +1,24 @@
1
+ FactoryGirl.define do
2
+ factory :access_grant, class: Doorkeeper::AccessGrant do
3
+ sequence(:resource_owner_id) { |n| n }
4
+ application
5
+ redirect_uri 'https://app.com/callback'
6
+ expires_in 100
7
+ scopes 'public write'
8
+ end
9
+
10
+ factory :access_token, class: Doorkeeper::AccessToken do
11
+ sequence(:resource_owner_id) { |n| n }
12
+ application
13
+ expires_in 2.hours
14
+
15
+ factory :clientless_access_token do
16
+ application nil
17
+ end
18
+ end
19
+
20
+ factory :application, class: Doorkeeper::Application do
21
+ sequence(:name) { |n| "Application #{n}" }
22
+ redirect_uri 'https://app.com/callback'
23
+ end
24
+ end
@@ -135,6 +135,20 @@ describe Doorkeeper, 'configuration' do
135
135
  end
136
136
  end
137
137
 
138
+ describe 'force_ssl_in_redirect_uri' do
139
+ it 'is true by default in non-development environments' do
140
+ expect(subject.force_ssl_in_redirect_uri).to be_truthy
141
+ end
142
+
143
+ it 'can change the value' do
144
+ Doorkeeper.configure do
145
+ orm DOORKEEPER_ORM
146
+ force_ssl_in_redirect_uri(false)
147
+ end
148
+ expect(subject.force_ssl_in_redirect_uri).to be_falsey
149
+ end
150
+ end
151
+
138
152
  describe 'access_token_credentials' do
139
153
  it 'has defaults order' do
140
154
  expect(subject.access_token_methods).to eq([:from_bearer_authorization, :from_access_token_param, :from_bearer_param])
@@ -28,7 +28,7 @@ module Doorkeeper::OAuth
28
28
  expect(Client.authenticate(credentials, authenticator)).to be_a(Client)
29
29
  end
30
30
 
31
- it 'retunrs nil if client was not authenticated' do
31
+ it 'returns nil if client was not authenticated' do
32
32
  credentials = Client::Credentials.new('some-uid', 'some-secret')
33
33
  authenticator = double
34
34
  expect(authenticator).to receive(:call).with('some-uid', 'some-secret').and_return(nil)
@@ -5,11 +5,19 @@ module Doorkeeper::OAuth
5
5
  let(:server) {
6
6
  server = Doorkeeper.configuration
7
7
  server.stub(:default_scopes) { Scopes.new }
8
- server.stub(:scopes) { Scopes.from_string('public') }
8
+ server.stub(:scopes) { Scopes.from_string('public profile') }
9
9
  server
10
10
  }
11
11
 
12
- let(:client) { double :client, redirect_uri: 'http://tst.com/auth' }
12
+ let(:application) do
13
+ application = double :application
14
+ application.stub(:scopes) { Scopes.from_string('') }
15
+ application
16
+ end
17
+
18
+ let(:client) do
19
+ double :client, redirect_uri: 'http://tst.com/auth', application: application
20
+ end
13
21
 
14
22
  let :attributes do
15
23
  {
@@ -71,9 +79,39 @@ module Doorkeeper::OAuth
71
79
  end
72
80
  end
73
81
 
74
- it 'accepts valid scopes' do
75
- subject.scope = 'public'
76
- expect(subject).to be_authorizable
82
+ context 'client application does not restrict valid scopes' do
83
+ it 'accepts valid scopes' do
84
+ subject.scope = 'public'
85
+ expect(subject).to be_authorizable
86
+ end
87
+
88
+ it 'rejects (globally) non-valid scopes' do
89
+ subject.scope = 'invalid'
90
+ expect(subject).not_to be_authorizable
91
+ end
92
+ end
93
+
94
+ context 'client application restricts valid scopes' do
95
+ let(:application) do
96
+ application = double :application
97
+ application.stub(:scopes) { Scopes.from_string('public nonsense') }
98
+ application
99
+ end
100
+
101
+ it 'accepts valid scopes' do
102
+ subject.scope = 'public'
103
+ expect(subject).to be_authorizable
104
+ end
105
+
106
+ it 'rejects (globally) non-valid scopes' do
107
+ subject.scope = 'invalid'
108
+ expect(subject).not_to be_authorizable
109
+ end
110
+
111
+ it 'rejects (application level) non-valid scopes' do
112
+ subject.scope = 'profile'
113
+ expect(subject).to_not be_authorizable
114
+ end
77
115
  end
78
116
 
79
117
  it 'uses default scopes when none is required' do
@@ -112,9 +150,5 @@ module Doorkeeper::OAuth
112
150
  expect(subject).not_to be_authorizable
113
151
  end
114
152
 
115
- it 'rejects non-valid scopes' do
116
- subject.scope = 'invalid'
117
- expect(subject).not_to be_authorizable
118
- end
119
153
  end
120
154
  end
@@ -173,5 +173,20 @@ module Doorkeeper
173
173
  expect(authenticated).to eq(app)
174
174
  end
175
175
  end
176
+
177
+ if Doorkeeper.configuration.orm == :active_record
178
+ describe :scopes do
179
+ it 'fails on missing column with an upgrade notice' do
180
+ app = FactoryGirl.build :application
181
+ no_scopes_app = double(attributes: [])
182
+ allow(Application).to receive(:new).and_return(no_scopes_app)
183
+
184
+ expect { app.scopes }.to raise_error(
185
+ NameError,
186
+ /Missing column: `applications.scopes`/
187
+ )
188
+ end
189
+ end
190
+ end
176
191
  end
177
192
  end
@@ -8,7 +8,9 @@ feature 'Adding applications' do
8
8
 
9
9
  scenario 'adding a valid app' do
10
10
  fill_in 'doorkeeper_application[name]', with: 'My Application'
11
- fill_in 'doorkeeper_application[redirect_uri]', with: 'http://example.com'
11
+ fill_in 'doorkeeper_application[redirect_uri]',
12
+ with: 'https://example.com'
13
+
12
14
  click_button 'Submit'
13
15
  i_should_see 'Application created'
14
16
  i_should_see 'My Application'
@@ -1,8 +1,10 @@
1
1
  ENV['RAILS_ENV'] ||= 'test'
2
- DOORKEEPER_ORM = (ENV['orm'] || :active_record).to_sym
3
2
  TABLE_NAME_PREFIX = ENV['table_name_prefix'] || nil
4
3
  TABLE_NAME_SUFFIX = ENV['table_name_suffix'] || nil
5
4
 
5
+ orm = ENV['BUNDLE_GEMFILE'].match(/Gemfile\.(.+)\.rb/)
6
+ DOORKEEPER_ORM = (orm && orm[1]) || :active_record
7
+
6
8
  $LOAD_PATH.unshift File.dirname(__FILE__)
7
9
 
8
10
  require 'capybara/rspec'
@@ -6,7 +6,7 @@ describe RedirectUriValidator do
6
6
  end
7
7
 
8
8
  it 'is valid when the uri is a uri' do
9
- subject.redirect_uri = 'http://example.com/callback'
9
+ subject.redirect_uri = 'https://example.com/callback'
10
10
  expect(subject).to be_valid
11
11
  end
12
12
 
@@ -34,13 +34,40 @@ describe RedirectUriValidator do
34
34
  end
35
35
 
36
36
  it 'is invalid when the uri has a fragment' do
37
- subject.redirect_uri = 'http://example.com/abcd#xyz'
37
+ subject.redirect_uri = 'https://example.com/abcd#xyz'
38
38
  expect(subject).not_to be_valid
39
39
  expect(subject.errors[:redirect_uri].first).to eq('cannot contain a fragment.')
40
40
  end
41
41
 
42
42
  it 'is invalid when the uri has a query parameter' do
43
- subject.redirect_uri = 'http://example.com/abcd?xyz=123'
43
+ subject.redirect_uri = 'https://example.com/abcd?xyz=123'
44
44
  expect(subject).to be_valid
45
45
  end
46
+
47
+ context 'force secured uri' do
48
+ it 'accepts an valid uri' do
49
+ subject.redirect_uri = 'https://example.com/callback'
50
+ expect(subject).to be_valid
51
+ end
52
+
53
+ it 'accepts native redirect uri' do
54
+ subject.redirect_uri = 'urn:ietf:wg:oauth:2.0:oob'
55
+ expect(subject).to be_valid
56
+ end
57
+
58
+ it 'accepts a non secured protocol when disabled' do
59
+ subject.redirect_uri = 'http://example.com/callback'
60
+ allow(Doorkeeper.configuration).to receive(
61
+ :force_ssl_in_redirect_uri
62
+ ).and_return(false)
63
+ expect(subject).to be_valid
64
+ end
65
+
66
+ it 'invalidates the uri when the uri does not use a secure protocol' do
67
+ subject.redirect_uri = 'http://example.com/callback'
68
+ expect(subject).not_to be_valid
69
+ error = subject.errors[:redirect_uri].first
70
+ expect(error).to eq('must be an HTTPS/SSL URI.')
71
+ end
72
+ end
46
73
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.alpha1
4
+ version: 2.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Elias Philipp
8
- - Piotr Jakubowski
8
+ - Tute Costa
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-11 00:00:00.000000000 Z
12
+ date: 2014-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 4.4.0
90
+ version: 4.5.0
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 4.4.0
97
+ version: 4.5.0
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: timecop
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -167,8 +167,7 @@ dependencies:
167
167
  version: 0.10.0
168
168
  description: Doorkeeper is an OAuth 2 provider for Rails.
169
169
  email:
170
- - felipe@applicake.com
171
- - piotr.jakubowski@applicake.com
170
+ - tutecosta@gmail.com
172
171
  executables: []
173
172
  extensions: []
174
173
  extra_rdoc_files: []
@@ -178,6 +177,7 @@ files:
178
177
  - ".rspec"
179
178
  - ".travis.yml"
180
179
  - CHANGELOG.md
180
+ - CONTRIBUTING.md
181
181
  - Gemfile
182
182
  - MIT-LICENSE
183
183
  - README.md
@@ -208,6 +208,11 @@ files:
208
208
  - app/views/layouts/doorkeeper/application.html.erb
209
209
  - config/locales/en.yml
210
210
  - doorkeeper.gemspec
211
+ - gemfiles/Gemfile.common.rb
212
+ - gemfiles/Gemfile.mongo_mapper.rb
213
+ - gemfiles/Gemfile.mongoid2.rb
214
+ - gemfiles/Gemfile.mongoid3.rb
215
+ - gemfiles/Gemfile.mongoid4.rb
211
216
  - lib/doorkeeper.rb
212
217
  - lib/doorkeeper/config.rb
213
218
  - lib/doorkeeper/engine.rb
@@ -289,10 +294,12 @@ files:
289
294
  - lib/doorkeeper/validations.rb
290
295
  - lib/doorkeeper/version.rb
291
296
  - lib/generators/doorkeeper/application_owner_generator.rb
297
+ - lib/generators/doorkeeper/application_scopes_generator.rb
292
298
  - lib/generators/doorkeeper/install_generator.rb
293
299
  - lib/generators/doorkeeper/migration_generator.rb
294
300
  - lib/generators/doorkeeper/templates/README
295
301
  - lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb
302
+ - lib/generators/doorkeeper/templates/add_scopes_to_oauth_applications.rb
296
303
  - lib/generators/doorkeeper/templates/initializer.rb
297
304
  - lib/generators/doorkeeper/templates/migration.rb
298
305
  - lib/generators/doorkeeper/views_generator.rb
@@ -331,19 +338,19 @@ files:
331
338
  - spec/dummy/config/mongoid3.yml
332
339
  - spec/dummy/config/mongoid4.yml
333
340
  - spec/dummy/config/routes.rb
341
+ - spec/dummy/db/development.sqlite3
334
342
  - spec/dummy/db/migrate/20111122132257_create_users.rb
335
343
  - spec/dummy/db/migrate/20120312140401_add_password_to_users.rb
336
344
  - spec/dummy/db/migrate/20130902165751_create_doorkeeper_tables.rb
337
345
  - spec/dummy/db/migrate/20130902175349_add_owner_to_application.rb
346
+ - spec/dummy/db/migrate/20141209001746_add_scopes_to_oauth_applications.rb
338
347
  - spec/dummy/db/schema.rb
339
348
  - spec/dummy/public/404.html
340
349
  - spec/dummy/public/422.html
341
350
  - spec/dummy/public/500.html
342
351
  - spec/dummy/public/favicon.ico
343
352
  - spec/dummy/script/rails
344
- - spec/factories/access_grant.rb
345
- - spec/factories/access_token.rb
346
- - spec/factories/application.rb
353
+ - spec/factories.rb
347
354
  - spec/generators/application_owner_generator_spec.rb
348
355
  - spec/generators/install_generator_spec.rb
349
356
  - spec/generators/migration_generator_spec.rb
@@ -442,3 +449,4 @@ signing_key:
442
449
  specification_version: 4
443
450
  summary: Doorkeeper is an OAuth 2 provider for Rails.
444
451
  test_files: []
452
+ has_rdoc:
@@ -1,9 +0,0 @@
1
- FactoryGirl.define do
2
- factory :access_grant, class: Doorkeeper::AccessGrant do
3
- sequence(:resource_owner_id) { |n| n }
4
- application
5
- redirect_uri 'https://app.com/callback'
6
- expires_in 100
7
- scopes 'public write'
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- FactoryGirl.define do
2
- factory :access_token, class: Doorkeeper::AccessToken do
3
- sequence(:resource_owner_id) { |n| n }
4
- application
5
- expires_in 2.hours
6
-
7
- factory :clientless_access_token do
8
- application nil
9
- end
10
- end
11
- end
@@ -1,6 +0,0 @@
1
- FactoryGirl.define do
2
- factory :application, class: Doorkeeper::Application do
3
- sequence(:name) { |n| "Application #{n}" }
4
- redirect_uri 'https://app.com/callback'
5
- end
6
- end