Sha256: df007e93c880275e3cce28966ec1b9de39035f4c5ebaecb5e18f1f8fef4a2ea6

Contents?: true

Size: 385 Bytes

Versions: 4

Compression:

Stored size: 385 Bytes

Contents

module SimpleTokenAuthentication
  class ExceptionFallbackHandler
    # Notifies the failure of authentication to Warden in the same DEvise does.
    # Does result in an HTTP 401 response in a Devise context.
    def fallback!(controller, entity)
      throw(:warden, scope: entity.name_underscore.to_sym) if controller.send("current_#{entity.name_underscore}").nil?
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple_token_authentication-1.12.0 lib/simple_token_authentication/exception_fallback_handler.rb
simple_token_authentication-1.11.0 lib/simple_token_authentication/exception_fallback_handler.rb
simple_token_authentication-1.10.1 lib/simple_token_authentication/exception_fallback_handler.rb
simple_token_authentication-1.10.0 lib/simple_token_authentication/exception_fallback_handler.rb