Sha256: f1815f0e95efc26fbff0af616c09c6c3467b451d9362ff6053d46938c2fb5c19

Contents?: true

Size: 408 Bytes

Versions: 8

Compression:

Stored size: 408 Bytes

Contents

module SimpleTokenAuthentication
  class ExceptionFallbackHandler
    include Singleton

    # 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

8 entries across 8 versions & 1 rubygems

Version Path
simple_token_authentication-1.18.1 lib/simple_token_authentication/exception_fallback_handler.rb
simple_token_authentication-1.18.0 lib/simple_token_authentication/exception_fallback_handler.rb
simple_token_authentication-1.17.0 lib/simple_token_authentication/exception_fallback_handler.rb
simple_token_authentication-1.16.0 lib/simple_token_authentication/exception_fallback_handler.rb
simple_token_authentication-1.15.1 lib/simple_token_authentication/exception_fallback_handler.rb
simple_token_authentication-1.15.0 lib/simple_token_authentication/exception_fallback_handler.rb
simple_token_authentication-1.14.0 lib/simple_token_authentication/exception_fallback_handler.rb
simple_token_authentication-1.13.0 lib/simple_token_authentication/exception_fallback_handler.rb