Skip to content

Commit

Permalink
Make gem 4.4 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
nbulaj committed Oct 4, 2018
1 parent 097899b commit 26b446a
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 18 deletions.
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "doorkeeper"]
path = doorkeeper
url = https://github.com/doorkeeper-gem/doorkeeper.git
branch = 4.4.0
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Changelog

User-visible changes worth mentioning.

## master

- [#] Description here

## 4.2.0

- [#32] Add `confidential` field for Doorkeeper >= 4.4
- [#34] Fixes to support Doorkeeper +. 4.4

## 4.1.0

- Update to upstream doorkeeper
- Fix mixins Access Token value generation to properly process custom
token generator class methods
- Lazy load ORM models using ActiveSupport hooks
- Clear code base from the dead code
- Refactor mixins

## 4.0.1

- Code refactoring
- [#26] Lazy ORM models loading
- [#28] Mongoid 6 and 7beta support
- Test against Rails 5.2
- Update to upstream of Doorkeeper
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,17 @@
to your Gemfile:

``` ruby
gem 'doorkeeper', '~> 4.0'
gem 'doorkeeper-mongodb', '~> 4.0'
# For Doorkeeper < 4.4
gem 'doorkeeper', '~> 4.3'
gem 'doorkeeper-mongodb', '~> 4.1.0'

# For Doorkeeper >= 4.4 && < 5.0
gem 'doorkeeper', '~> 4.4'
gem 'doorkeeper-mongodb', '~> 4.2'

# For Doorkeeper >= 5.0
gem 'doorkeeper', '~> 5.0'
gem 'doorkeeper-mongodb', '~> 5.0'

# or if you want to use cutting edge version:
# gem 'doorkeeper-mongodb', github: 'doorkeeper-gem/doorkeeper-mongodb'
Expand Down Expand Up @@ -72,6 +81,7 @@ variables defined in `.travis.yml` file.
To run locally, you need to choose a gemfile, with a command similar to:

```
$ export RAILS=5.1
$ export BUNDLE_GEMFILE=$PWD/gemfiles/Gemfile.mongoid6.rb
```

Expand Down
2 changes: 1 addition & 1 deletion doorkeeper
Submodule doorkeeper updated 52 files
+4 −0 .rubocop.yml
+31 −2 NEWS.md
+55 −32 README.md
+2 −1 app/controllers/doorkeeper/applications_controller.rb
+9 −10 app/controllers/doorkeeper/tokens_controller.rb
+11 −0 app/views/doorkeeper/applications/_form.html.erb
+2 −0 app/views/doorkeeper/applications/index.html.erb
+3 −0 app/views/doorkeeper/applications/show.html.erb
+6 −0 config/locales/en.yml
+2 −0 doorkeeper.gemspec
+1 −0 lib/doorkeeper.rb
+17 −1 lib/doorkeeper/config.rb
+1 −0 lib/doorkeeper/models/access_grant_mixin.rb
+3 −2 lib/doorkeeper/models/access_token_mixin.rb
+9 −1 lib/doorkeeper/models/application_mixin.rb
+13 −0 lib/doorkeeper/models/concerns/orderable.rb
+7 −2 lib/doorkeeper/oauth/base_request.rb
+3 −1 lib/doorkeeper/oauth/client/credentials.rb
+15 −0 lib/doorkeeper/oauth/helpers/uri_checker.rb
+5 −3 lib/doorkeeper/oauth/pre_authorization.rb
+0 −1 lib/doorkeeper/orm/active_record.rb
+1 −1 lib/doorkeeper/orm/active_record/access_grant.rb
+1 −1 lib/doorkeeper/orm/active_record/access_token.rb
+18 −1 lib/doorkeeper/orm/active_record/application.rb
+0 −11 lib/doorkeeper/orm/active_record/base_record.rb
+5 −1 lib/doorkeeper/rails/routes.rb
+1 −11 lib/doorkeeper/request/password.rb
+23 −2 lib/doorkeeper/version.rb
+31 −0 lib/generators/doorkeeper/add_client_confidentiality_generator.rb
+11 −0 lib/generators/doorkeeper/templates/add_confidential_to_application_migration.rb.erb
+11 −0 lib/generators/doorkeeper/templates/initializer.rb
+1 −0 lib/generators/doorkeeper/templates/migration.rb.erb
+34 −2 spec/controllers/authorizations_controller_spec.rb
+59 −7 spec/controllers/tokens_controller_spec.rb
+16 −0 spec/dummy/config/initializers/doorkeeper.rb
+3 −1 spec/dummy/db/migrate/20111122132257_create_users.rb
+3 −1 spec/dummy/db/migrate/20120312140401_add_password_to_users.rb
+3 −1 spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb
+3 −1 spec/dummy/db/migrate/20151223200000_add_owner_to_application.rb
+3 −1 spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb
+13 −0 spec/dummy/db/migrate/20180210183654_add_confidential_to_application.rb
+2 −1 spec/dummy/db/schema.rb
+25 −0 spec/lib/config_spec.rb
+18 −3 spec/lib/oauth/authorization_code_request_spec.rb
+4 −2 spec/lib/oauth/client/credentials_spec.rb
+110 −1 spec/lib/oauth/helpers/uri_checker_spec.rb
+3 −3 spec/lib/oauth/password_access_token_request_spec.rb
+12 −7 spec/lib/oauth/pre_authorization_spec.rb
+3 −3 spec/lib/oauth/refresh_token_request_spec.rb
+96 −5 spec/models/doorkeeper/application_spec.rb
+1 −1 spec/requests/flows/authorization_code_spec.rb
+64 −21 spec/requests/flows/password_spec.rb
2 changes: 1 addition & 1 deletion doorkeeper-mongodb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
gem.files = Dir['lib/**/*', 'config/**/*', 'MIT-LICENSE', 'Rakefile', 'README.md']
gem.test_files = Dir['spec/**/*']

gem.add_dependency 'doorkeeper', '>= 4.4.3', '< 5.0'
gem.add_dependency 'doorkeeper', '>= 4.4', '< 5.0'

gem.add_development_dependency 'grape'
gem.add_development_dependency 'coveralls'
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.mongoid7.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gemfile = File.expand_path('../Gemfile.common.rb', __FILE__)
instance_eval IO.read(gemfile), gemfile

gem 'mongoid', '~> 7.0.0'
gem 'mongoid', '~> 7.0'
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,8 @@ def by_uid(uid)
end

def supports_confidentiality?
if ENV['RAILS_ENV'] ||= 'test'
if respond_to?(:column_names)
column_names.include?("confidential")
else
fields.include?("confidential")
end
if respond_to?(:column_names)
column_names.include?("confidential")
else
fields.include?("confidential")
end
Expand Down
8 changes: 2 additions & 6 deletions lib/doorkeeper-mongodb/mixins/mongoid/application_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,8 @@ def by_uid(uid)
end

def supports_confidentiality?
if ENV['RAILS_ENV'] ||= 'test'
if respond_to?(:column_names)
column_names.include?("confidential")
else
fields.include?("confidential")
end
if respond_to?(:column_names)
column_names.include?("confidential")
else
fields.include?("confidential")
end
Expand Down
2 changes: 1 addition & 1 deletion lib/doorkeeper/orm/mongo_mapper/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Application
key :uid, String
key :secret, String
key :redirect_uri, String
key :confidential, Boolean
key :confidential, Boolean, default: true
key :scopes, String

def self.authorized_for(resource_owner)
Expand Down

0 comments on commit 26b446a

Please sign in to comment.