Skip to content

Commit

Permalink
Add generators, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nbulaj committed Oct 4, 2018
1 parent 5853f1c commit 4d3a353
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ rake doorkeeper_sequel:generate:migration
rake doorkeeper_sequel:generate:application_owner
rake doorkeeper_sequel:generate:previous_refresh_token
rake doorkeeper_sequel:generate:confidential_applications # for Doorkeeper >= 4.4
rake doorkeeper_sequel:generate:pkce # for Doorkeeper >= 5.x
```

## Tests
Expand Down
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class ExtensionIntegrator
FileUtils.rm('spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb', force: true)
FileUtils.rm('spec/dummy/config/initializers/new_framework_defaults.rb', force: true)
FileUtils.rm('spec/models/doorkeeper/base_record_spec.rb', force: true)
# TODO: write own specs
FileUtils.rm('spec/lib/orm/active_record/stale_records_cleaner_spec.rb', force: true)
# Remove generators specs because we are using our own
FileUtils.rm(Dir.glob('spec/generators/*.rb'))
Expand Down
2 changes: 1 addition & 1 deletion doorkeeper
Submodule doorkeeper updated 81 files
+5 −0 .travis.yml
+57 −0 Dangerfile
+2 −0 NEWS.md
+2 −0 app/controllers/doorkeeper/application_controller.rb
+2 −0 app/controllers/doorkeeper/application_metal_controller.rb
+2 −0 app/controllers/doorkeeper/applications_controller.rb
+2 −0 app/controllers/doorkeeper/authorizations_controller.rb
+2 −0 app/controllers/doorkeeper/authorized_applications_controller.rb
+2 −0 app/controllers/doorkeeper/token_info_controller.rb
+2 −0 app/controllers/doorkeeper/tokens_controller.rb
+2 −0 app/helpers/doorkeeper/dashboard_helper.rb
+2 −0 app/validators/redirect_uri_validator.rb
+23 −22 doorkeeper.gemspec
+1 −0 lib/doorkeeper.rb
+2 −0 lib/doorkeeper/engine.rb
+3 −0 lib/doorkeeper/errors.rb
+2 −0 lib/doorkeeper/grape/authorization_decorator.rb
+2 −0 lib/doorkeeper/grape/helpers.rb
+2 −0 lib/doorkeeper/helpers/controller.rb
+2 −0 lib/doorkeeper/models/access_grant_mixin.rb
+2 −0 lib/doorkeeper/models/access_token_mixin.rb
+2 −0 lib/doorkeeper/models/application_mixin.rb
+2 −0 lib/doorkeeper/models/concerns/accessible.rb
+2 −0 lib/doorkeeper/models/concerns/expirable.rb
+2 −0 lib/doorkeeper/models/concerns/orderable.rb
+2 −0 lib/doorkeeper/models/concerns/ownership.rb
+2 −0 lib/doorkeeper/models/concerns/revocable.rb
+2 −0 lib/doorkeeper/models/concerns/scopes.rb
+2 −0 lib/doorkeeper/oauth/authorization/code.rb
+2 −0 lib/doorkeeper/oauth/authorization/context.rb
+2 −0 lib/doorkeeper/oauth/authorization/token.rb
+2 −0 lib/doorkeeper/oauth/authorization/uri_builder.rb
+2 −0 lib/doorkeeper/oauth/authorization_code_request.rb
+2 −0 lib/doorkeeper/oauth/base_request.rb
+2 −0 lib/doorkeeper/oauth/base_response.rb
+2 −0 lib/doorkeeper/oauth/client.rb
+2 −0 lib/doorkeeper/oauth/client/credentials.rb
+2 −0 lib/doorkeeper/oauth/client_credentials/creator.rb
+2 −0 lib/doorkeeper/oauth/client_credentials/issuer.rb
+2 −0 lib/doorkeeper/oauth/client_credentials/validation.rb
+2 −0 lib/doorkeeper/oauth/client_credentials_request.rb
+2 −0 lib/doorkeeper/oauth/code_request.rb
+2 −0 lib/doorkeeper/oauth/code_response.rb
+2 −0 lib/doorkeeper/oauth/error.rb
+2 −0 lib/doorkeeper/oauth/error_response.rb
+2 −0 lib/doorkeeper/oauth/forbidden_token_response.rb
+2 −0 lib/doorkeeper/oauth/helpers/scope_checker.rb
+2 −0 lib/doorkeeper/oauth/helpers/unique_token.rb
+2 −0 lib/doorkeeper/oauth/helpers/uri_checker.rb
+2 −0 lib/doorkeeper/oauth/invalid_token_response.rb
+2 −0 lib/doorkeeper/oauth/password_access_token_request.rb
+2 −0 lib/doorkeeper/oauth/pre_authorization.rb
+2 −0 lib/doorkeeper/oauth/refresh_token_request.rb
+2 −0 lib/doorkeeper/oauth/scopes.rb
+2 −0 lib/doorkeeper/oauth/token.rb
+2 −0 lib/doorkeeper/oauth/token_introspection.rb
+2 −0 lib/doorkeeper/oauth/token_request.rb
+2 −0 lib/doorkeeper/oauth/token_response.rb
+2 −0 lib/doorkeeper/orm/active_record.rb
+2 −0 lib/doorkeeper/rails/helpers.rb
+2 −0 lib/doorkeeper/rails/routes.rb
+2 −0 lib/doorkeeper/rails/routes/mapper.rb
+2 −0 lib/doorkeeper/rails/routes/mapping.rb
+4 −4 lib/doorkeeper/rake/db.rake
+2 −0 lib/doorkeeper/request.rb
+2 −0 lib/doorkeeper/request/authorization_code.rb
+2 −0 lib/doorkeeper/request/client_credentials.rb
+2 −0 lib/doorkeeper/request/code.rb
+2 −0 lib/doorkeeper/request/password.rb
+2 −0 lib/doorkeeper/request/refresh_token.rb
+2 −0 lib/doorkeeper/request/strategy.rb
+2 −0 lib/doorkeeper/request/token.rb
+2 −0 lib/doorkeeper/server.rb
+20 −0 lib/doorkeeper/stale_records_cleaner.rb
+2 −0 lib/doorkeeper/validations.rb
+2 −0 lib/doorkeeper/version.rb
+2 −2 lib/generators/doorkeeper/templates/migration.rb.erb
+6 −6 spec/factories.rb
+1 −1 spec/lib/stale_records_cleaner_spec.rb
+1 −1 spec/requests/flows/authorization_code_spec.rb
+2 −1 spec/support/doorkeeper_rspec.rb
14 changes: 14 additions & 0 deletions lib/doorkeeper-sequel/generators/pkce_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module DoorkeeperSequel
class PkceGenerator < ::Thor::Group
include ::Thor::Actions
include MigrationActions

source_root File.expand_path('../templates', __FILE__)

desc 'Provide support for PKCE.'

def install
create_migration 'enable_pkce_migration.rb.erb'
end
end
end
10 changes: 10 additions & 0 deletions lib/doorkeeper-sequel/tasks/doorkeeper-sequel.rake
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,15 @@ namespace :doorkeeper_sequel do
task :previous_refresh_token do
DoorkeeperSequel::PreviousRefreshTokenGenerator.start
end

desc 'Generate migration file for PKCE'
task :pkce do
DoorkeeperSequel::PkceGenerator.start
end

desc 'Add confidential column to Doorkeeper applications'
task :confidential_applications do
DoorkeeperSequel::ConfidentialApplicationsGenerator.start
end
end
end
2 changes: 2 additions & 0 deletions lib/doorkeeper/orm/sequel.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'doorkeeper/orm/sequel/stale_records_cleaner'

module Doorkeeper
module Orm
module Sequel
Expand Down
2 changes: 1 addition & 1 deletion lib/doorkeeper/orm/sequel/stale_records_cleaner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(base_scope)

def clean_revoked
@base_scope
.where(Sequel.~(revoked_at: nil))
.where(::Sequel.~(revoked_at: nil))
.where { revoked_at < Time.current }
.delete
end
Expand Down

0 comments on commit 4d3a353

Please sign in to comment.