module Doorkeeper
Define methods that can be called in any controller that inherits from Doorkeeper::ApplicationMetalController or Doorkeeper::ApplicationController
Public Class Methods
authenticate(request, methods = Doorkeeper.configuration.access_token_methods)
click to toggle source
# File lib/doorkeeper.rb, line 72 def self.authenticate(request, methods = Doorkeeper.configuration.access_token_methods) OAuth::Token.authenticate(request, *methods) end
configuration()
click to toggle source
# File lib/doorkeeper/config.rb, line 17 def self.configuration @config || (fail MissingConfiguration) end
configure(&block)
click to toggle source
# File lib/doorkeeper/config.rb, line 10 def self.configure(&block) @config = Config::Builder.new(&block).build setup_orm_adapter setup_orm_models setup_application_owner if @config.enable_application_owner? end
configured?()
click to toggle source
# File lib/doorkeeper.rb, line 57 def self.configured? ActiveSupport::Deprecation.warn "Method `Doorkeeper#configured?` has been deprecated without replacement." @config.present? end
database_installed?()
click to toggle source
# File lib/doorkeeper.rb, line 62 def self.database_installed? ActiveSupport::Deprecation.warn "Method `Doorkeeper#database_installed?` has been deprecated without replacement." [AccessToken, AccessGrant, Application].all?(&:table_exists?) end
gem_version()
click to toggle source
# File lib/doorkeeper/version.rb, line 2 def self.gem_version Gem::Version.new VERSION::STRING end
installed?()
click to toggle source
# File lib/doorkeeper.rb, line 67 def self.installed? ActiveSupport::Deprecation.warn "Method `Doorkeeper#installed?` has been deprecated without replacement." configured? && database_installed? end
setup_application_owner()
click to toggle source
# File lib/doorkeeper/config.rb, line 37 def self.setup_application_owner @orm_adapter.initialize_application_owner! end
setup_orm_adapter()
click to toggle source
# File lib/doorkeeper/config.rb, line 21 def self.setup_orm_adapter @orm_adapter = "doorkeeper/orm/#{configuration.orm}".classify.constantize rescue NameError => e fail e, "ORM adapter not found (#{configuration.orm})", "[doorkeeper] ORM adapter not found (#{configuration.orm}), or there was an error trying to load it. You probably need to add the related gem for this adapter to work with doorkeeper. ".squish end
setup_orm_models()
click to toggle source
# File lib/doorkeeper/config.rb, line 33 def self.setup_orm_models @orm_adapter.initialize_models! end