module Doorkeeper
def authenticate(request, methods = Doorkeeper.config.access_token_methods)
def authenticate(request, methods = Doorkeeper.config.access_token_methods) OAuth::Token.authenticate(request, *methods) end
def configuration
-
(Doorkeeper::Config)
- configuration instance
def configuration @config || configure end
def configure(&block)
def configure(&block) @config = Config::Builder.new(&block).build setup @config end
def configured?
def configured? !@config.nil? end
def gem_version
def gem_version ::Gem::Version.new(::Doorkeeper::VERSION::STRING) end
def run_orm_hooks
def run_orm_hooks config.clear_cache! if @orm_adapter.respond_to?(:run_hooks) @orm_adapter.run_hooks else ::Kernel.warn <<~MSG.strip_heredoc [DOORKEEPER] ORM "#{configuration.orm}" should move all it's setup logic under `#run_hooks` method for the #{@orm_adapter.name}. Later versions of Doorkeeper will no longer support `setup_orm_models` and `setup_application_owner` API. MSG end end
def setup
def setup setup_orm_adapter # Deprecated, will be removed soon unless configuration.orm == :active_record setup_orm_models setup_application_owner end end
def setup_application_owner
def setup_application_owner @orm_adapter.initialize_application_owner! end
def setup_orm_adapter
def setup_orm_adapter @orm_adapter = "doorkeeper/orm/#{configuration.orm}".classify.constantize rescue NameError => e raise e, "ORM adapter not found (#{configuration.orm})", <<-ERROR_MSG.strip_heredoc [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. ERROR_MSG end
def setup_orm_models
def setup_orm_models @orm_adapter.initialize_models! end