module Doorkeeper::Request

def authorization_response_types

def authorization_response_types
  Doorkeeper.configuration.authorization_response_types
end

def authorization_strategy(response_type)

def authorization_strategy(response_type)
  get_strategy response_type, authorization_response_types
rescue NameError
  raise Errors::InvalidAuthorizationStrategy
end

def get_strategy(grant_or_request_type, available)

def get_strategy(grant_or_request_type, available)
  fail Errors::MissingRequestStrategy unless grant_or_request_type.present?
  fail NameError unless available.include?(grant_or_request_type.to_s)
  "Doorkeeper::Request::#{grant_or_request_type.to_s.camelize}".constantize
end

def token_grant_types

def token_grant_types
  Doorkeeper.configuration.token_grant_types
end

def token_strategy(grant_type)

def token_strategy(grant_type)
  get_strategy grant_type, token_grant_types
rescue NameError
  raise Errors::InvalidTokenStrategy
end