module Doorkeeper
def self.authenticate(request, methods = Doorkeeper.configuration.access_token_methods)
def self.authenticate(request, methods = Doorkeeper.configuration.access_token_methods) OAuth::Token.authenticate(request, *methods) end
def self.configuration
def self.configuration @config || (fail MissingConfiguration) end
def self.configure(&block)
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
def self.configured?
def self.configured? ActiveSupport::Deprecation.warn "Method `Doorkeeper#configured?` has been deprecated without replacement." @config.present? end
def self.database_installed?
def self.database_installed? ActiveSupport::Deprecation.warn "Method `Doorkeeper#database_installed?` has been deprecated without replacement." [AccessToken, AccessGrant, Application].all?(&:table_exists?) end
def self.gem_version
def self.gem_version Gem::Version.new VERSION::STRING end
def self.installed?
def self.installed? ActiveSupport::Deprecation.warn "Method `Doorkeeper#installed?` has been deprecated without replacement." configured? && database_installed? end
def self.setup_application_owner
def self.setup_application_owner @orm_adapter.initialize_application_owner! end
def self.setup_orm_adapter
def self.setup_orm_adapter @orm_adapter = "doorkeeper/orm/#{configuration.orm}".classify.constantize rescue NameError => e fail e, "ORM adapter not found (#{configuration.orm})", <<-ERROR_MSG.squish oorkeeper] ORM adapter not found (#{configuration.orm}), or there was an error ying to load it. u probably need to add the related gem for this adapter to work with orkeeper. ERROR_MSG end
def self.setup_orm_models
def self.setup_orm_models @orm_adapter.initialize_models! end