Module: Doorkeeper::Request

Defined in:
lib/doorkeeper/request.rb,
lib/doorkeeper/request/code.rb,
lib/doorkeeper/request/token.rb,
lib/doorkeeper/request/password.rb,
lib/doorkeeper/request/refresh_token.rb,
lib/doorkeeper/request/authorization_code.rb,
lib/doorkeeper/request/client_credentials.rb

Defined Under Namespace

Classes: AuthorizationCode, ClientCredentials, Code, Password, RefreshToken, Token

Class Method Summary collapse

Class Method Details

.authorization_strategy(strategy) ⇒ Object


12
13
14
15
16
# File 'lib/doorkeeper/request.rb', line 12

def authorization_strategy(strategy)
  get_strategy strategy, Doorkeeper.configuration.authorization_response_types
rescue NameError
  raise Errors::InvalidAuthorizationStrategy
end

.get_strategy(strategy, available) ⇒ Object


24
25
26
27
28
# File 'lib/doorkeeper/request.rb', line 24

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

.token_strategy(strategy) ⇒ Object


18
19
20
21
22
# File 'lib/doorkeeper/request.rb', line 18

def token_strategy(strategy)
  get_strategy strategy, Doorkeeper.configuration.token_grant_types
rescue NameError
  raise Errors::InvalidTokenStrategy
end