Class: Oauned::Strategy

Inherits:
Devise::Strategies::Authenticatable
  • Object
show all
Defined in:
lib/oauned/strategy.rb

Instance Method Summary collapse

Instance Method Details

#access_tokenObject



20
21
22
23
# File 'lib/oauned/strategy.rb', line 20

def access_token
  match = request.authorization.match(/^OAuth2 (.*)$/) if request.authorization
  match.nil? ? nil : match[1]
end

#authenticate!Object



10
11
12
13
14
15
16
17
18
# File 'lib/oauned/strategy.rb', line 10

def authenticate!
  resource = mapping.to.find_for_oauth_authentication access_token

  if resource
    success!(resource)
  else
    fail(:invalid)
  end
end

#valid?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/oauned/strategy.rb', line 6

def valid?
  !access_token.nil?
end