Authentication Generator
Synopsis
azu generate auth [options]Description
Features
Core Authentication
Security Features
Advanced Features
Usage
Basic Usage
Strategy-Specific Generation
Authly (Recommended)
JWT Only
Session-Based
OAuth
Advanced Options
Options
Option
Type
Default
Description
Custom User Model
Generated Files
Directory Structure
File Descriptions
User Model (src/models/user.cr)
src/models/user.cr)Authentication Endpoints (src/endpoints/auth/*_endpoint.cr)
src/endpoints/auth/*_endpoint.cr)CSRF Protection Middleware (src/middleware/csrf_protection.cr)
src/middleware/csrf_protection.cr)Security Headers Middleware (src/middleware/security_headers.cr)
src/middleware/security_headers.cr)Database Schema
Users Table
Column
Type
Description
RBAC Tables (when --enable-rbac)
--enable-rbac)Roles Table
Column
Type
Description
Permissions Table
Column
Type
Description
User_Roles Junction Table
Column
Type
Description
Role_Permissions Junction Table
Column
Type
Description
OAuth Tables (when --strategy authly)
--strategy authly)OAuth_Applications Table
Column
Type
Description
OAuth_Access_Tokens Table
Column
Type
Description
Configuration
Environment Variables
Authly Configuration (src/config/authly.cr)
src/config/authly.cr)Usage Examples
User Registration
User Login
Token Refresh
Password Reset
Using Authentication in Endpoints
RBAC Usage
Seeding Roles and Permissions
Checking Permissions
Security Best Practices
1. Strong Secrets
2. Password Requirements
3. Rate Limiting
4. Secure Token Storage
5. Token Rotation
Dependencies
Migration and Setup
Testing
Troubleshooting
JWT Token Issues
BCrypt Cost Too High
CSRF Token Mismatch
Account Lockout
Related Documentation
See Also
Last updated