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_basic_authorization, from_bearer_authorization, from_bearer_param

Class Method Details

.authenticate(request, *methods) ⇒ Object


56
57
58
59
60
# File 'lib/doorkeeper/oauth/token.rb', line 56

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

.from_request(request, *methods) ⇒ Object


48
49
50
51
52
53
54
# File 'lib/doorkeeper/oauth/token.rb', line 48

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