Class: SimpleTokenAuthentication::ExceptionFallbackHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_token_authentication/exception_fallback_handler.rb

Instance Method Summary collapse

Instance Method Details

#fallback!(controller, entity) ⇒ Object

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



5
6
7
# File 'lib/simple_token_authentication/exception_fallback_handler.rb', line 5

def fallback!(controller, entity)
  throw(:warden, scope: entity.name_underscore.to_sym) if controller.send("current_#{entity.name_underscore}").nil?
end