Class: SimpleTokenAuthentication::ExceptionFallbackHandler

Inherits:
Object
  • Object
show all
Includes:
Singleton
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.



7
8
9
# 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