Class: Doorkeeper::OAuth::Token

Inherits:
Object
  • Object
show all
Extended by:
Methods
Defined in:
lib/doorkeeper/oauth/token.rb

Defined Under Namespace

Modules: Methods

Class Method Summary collapse

Methods included from Methods

from_access_token_param, from_bearer_authorization, from_bearer_param

Class Method Details

.authenticate(request, *methods) ⇒ Object



30
31
32
33
# File 'lib/doorkeeper/oauth/token.rb', line 30

def self.authenticate(request, *methods)
  token = from_request request, *methods
  Doorkeeper::AccessToken.authenticate(token) if token
end

.from_request(request, *methods) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/doorkeeper/oauth/token.rb', line 22

def self.from_request(request, *methods)
  methods.inject(nil) do |credentials, method|
    method = self.method(method) if method.is_a?(Symbol)
    credentials = method.call(request)
    break credentials unless credentials.blank?
  end
end