Module: Workarea::Api::Storefront::Authentication

Extended by:
ActiveSupport::Concern
Included in:
ApplicationController
Defined in:
app/controllers/workarea/api/storefront/authentication.rb

Defined Under Namespace

Classes: InvalidError

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_user(token, options) ⇒ Object



13
14
15
# File 'app/controllers/workarea/api/storefront/authentication.rb', line 13

def self.find_user(token, options)
  User::AuthenticationToken.authenticate(token, options).try(:user)
end

Instance Method Details

#authentication?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'app/controllers/workarea/api/storefront/authentication.rb', line 21

def authentication?
  current_visit.logged_in?
end

#current_userObject



17
18
19
# File 'app/controllers/workarea/api/storefront/authentication.rb', line 17

def current_user
  current_visit.current_user || raise(InvalidError)
end