class SimpleTokenAuthentication::ExceptionFallbackHandler

Public Instance Methods

fallback!(controller, entity) click to toggle source

Notifies the failure of authentication to Warden in the same Devise does. Does result in an HTTP 401 response in a Devise context.

# File lib/simple_token_authentication/exception_fallback_handler.rb, line 7
def fallback!(controller, entity)
  throw(:warden, scope: entity.name_underscore.to_sym) if controller.send("current_#{entity.name_underscore}").nil?
end