class
Kemal::BasicAuth::ProcVerifier
- Kemal::BasicAuth::ProcVerifier
- Kemal::BasicAuth::Verifier
- Reference
- Object
Overview
Dynamic verifier that delegates to a user-provided callback. Useful when credentials come from a database, environment variables, or any other external source.
The callback receives the submitted username and password and must return
true if the credentials are valid.
verifier = Kemal::BasicAuth::ProcVerifier.new do |user, pass|
User.authenticate(user, pass)
end
Note: timing characteristics of the callback are the implementer's
responsibility. For password storage, prefer hashed comparison
(e.g. Crypto::Bcrypt::Password).
Defined in:
kemal-basic-auth/proc_verifier.crConstructors
Instance Method Summary
-
#authorize?(username : String, password : String) : String | Nil
Returns the authorized username on success, or
nilotherwise.
Instance methods inherited from class Kemal::BasicAuth::Verifier
authorize?(username : String, password : String) : String | Nil
authorize?
Constructor Detail
Instance Method Detail
def authorize?(username : String, password : String) : String | Nil
#
Description copied from class Kemal::BasicAuth::Verifier
Returns the authorized username on success, or nil otherwise.