{"repo":"kemalcr/kemal-basic-auth","free":true,"listed":false,"github":"https://github.com/kemalcr/kemal-basic-auth","clone":"git clone https://github.com/kemalcr/kemal-basic-auth.git","description":"Basic Auth for Kemal applications","language":"Crystal","stars":19,"topics":["kemal","basic-authentication","authentication","basic-auth"],"license":"MIT","category":"auth-billing-email","readme_excerpt":"kemal-basic-auth Add basic auth to your Kemal application. Basic Auth sends credentials Base64-encoded (not encrypted). Always serve your application over HTTPS in production to avoid leaking credentials. Requirements - Crystal = 1.12.0 - Kemal = 1.0.0 Installation Add this to your application's shard.yml : Usage Basic example kemal-basic-auth adds authentication to all routes by default. Customizing the realm and 401 body Hashed passwords with bcrypt For production credentials, store bcrypt hashes rather than plaintext: Dynamic credentials (database, environment, ...) The block form lets you decide whether a username/password is valid at request time, e.g. by looking up a row in your database: Throttling failed attempts A simple in-memory rate limiter can be attached to slow down brute-force attempts. The limiter keys off the request's remote address; once a threshold is reached the handler responds with 429 Too Many Requests and a Retry-After header until the window elapses. A successful authentication clears the counter for that remote. Authentication for specific routes Kemal::BasicAuth::Handler inherits from Kemal::Handler . With the built-in only / exclude macros the base handler automatically restricts authentication to those routes; you no longer have to override call . exclude works the same way and can be combined with only ( exclude takes precedence): The legacy manual override pattern from earlier versions still works: kemal authorized username HTTP::Server::Conte","default_branch":null,"files":null,"tree":[],"storefront":"/r/kemalcr","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/kemalcr/kemal-basic-auth/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}