class Kemal::BasicAuth::Credentials

Overview

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.

Defined in:

kemal-basic-auth/credentials.cr

Constructors

Instance Method Summary

Instance methods inherited from class Kemal::BasicAuth::Verifier

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

Constructor Detail

def self.new(entries : Hash(String, String) = Hash(String, String).new) #

[View source]

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.


[View source]