# Announcing kemal-auth — comprehensive authentication for Kemal

**URL:** <https://forum.crystal-lang.org/t/announcing-kemal-auth-comprehensive-authentication-for-kemal/8868>\
**Category:** News\
**Created:** [April 10, 2026, 3:54pm UTC](https://forum.crystal-lang.org/t/announcing-kemal-auth-comprehensive-authentication-for-kemal/8868 "2026-04-10T15:54:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![papilip](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/papilip/32/3305_2.png) [@papilip](https://forum.crystal-lang.org/u/papilip)\
**Post date:** [April 10, 2026, 3:54pm UTC](https://forum.crystal-lang.org/t/announcing-kemal-auth-comprehensive-authentication-for-kemal/8868/1 "2026-04-10T15:54:54Z")

</div>

Hi everyone,

I’ve just published **kemal-auth** , a comprehensive authentication library for [Kemal](https://kemalcr.com/) web applications.

The existing Kemal auth shards (kemal-auth-token, kemal-basic-auth, kemal-jwt-auth) have all been abandoned for 4-7 years. kemal-auth aims to provide a maintained, full-featured alternative.

## Features

| Module | Description |
| --- | --- |
| `KemalAuth::Password` | BCrypt password hashing with CNIL-compliant rules (12+ chars, uppercase, lowercase, digit, special char) |
| `KemalAuth::Token` | JWT token generation and verification |
| `KemalAuth::Session` | Session management via HTTP cookies |
| `KemalAuth::SmtpConfig` | Configurable SMTP settings (constructor, Hash, or environment variables) |
| `KemalAuth::PasswordReset` | Password recovery via email with JWT-based reset links |
| `KemalAuth::UserManager` | User validation, invitations, and temporary password generation |

## Quick example

```crystal
require "kemal_auth"

# Hash and verify passwords
hash = KemalAuth::Password.hash("MyStr0ng!Pass")
KemalAuth::Password.verify("MyStr0ng!Pass", hash) # => true

# Generate JWT tokens
token = KemalAuth::Token.generate(
  secret: ENV["SESSION_SECRET"],
  sub: "1",
  email: "user@example.com",
  role: "admin"
)

# Send password reset emails
smtp = KemalAuth::SmtpConfig.new(host: "smtp.example.com", port: 587, ...)
KemalAuth::PasswordReset.send_reset_email(
  email: "user@example.com",
  reset_url: "https://myapp.com/reset-password",
  secret: ENV["SESSION_SECRET"],
  smtp: smtp
)

```

## Installation

```yaml
dependencies:
  kemal-auth:
    github: aloli-crystal/kemal-auth
    version: "~> 0.1"

```

- **52 tests** , 0 failures
- Documentation in English and French
- [GitHub](https://github.com/aloli-crystal/kemal-auth)

Feedback and contributions welcome !
