class

Kemal::BasicAuth::Credentials

Inherits Kemal::BasicAuth::Verifier < Reference < Object

Plaintext credentials verifier backed by a Hash(String, String).

Comparison is performed in length-equalized form (SHA-256 digests) so the response time does not depend on whether the username exists or how the given password compares to the stored one. SHA-256 is used purely for timing equalization here, not for password storage; if you need hashed storage use BcryptVerifier.

Constructors

new(entries : Hash(String, String) = Hash(String, String).new)
Source

Instance methods

authorize?(username : String, password : String) : String | Nil

Returns the authorized username on success, or nil otherwise.

Source