Class: SiriusApi::Strategies::LocalToken

Inherits:
Warden::Strategies::Base
  • Object
show all
Defined in:
lib/sirius_api/strategies/local_token.rb

Instance Method Summary collapse

Instance Method Details

#access_tokenObject


9
10
11
# File 'lib/sirius_api/strategies/local_token.rb', line 9

def access_token
  params['access_token']
end

#authenticate!Object


17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sirius_api/strategies/local_token.rb', line 17

def authenticate!
  if access_token.blank?
    errors.add(:general, 'Missing local access token.')
    return
  end
  username = Person.id_from_token(access_token)
  if username.nil?
    errors.add(:general, 'Invalid local access token.')
    return
  end
  success! User.new(username.freeze, Scopes::READ_PERSONAL)
end

#store?Boolean

Returns:

  • (Boolean)

13
14
15
# File 'lib/sirius_api/strategies/local_token.rb', line 13

def store?
  false
end