Daycry Auth Documentation๏
Welcome to the complete documentation for Daycry Auth, a comprehensive authentication and authorization library for CodeIgniter 4.
Getting Started
- Quick Start Guide
- โ๏ธ Configuration Reference
- The Configuration Files
- Database
- Authenticators
- Session Authenticator
- User Settings
- Password Settings
- Password Reset
- Per-User Account Lockout
- Magic Links
- Access Tokens
- JWT Refresh Tokens
- Logging & Monitoring
- Authorization Cache
- Views
- Redirects
- Routes
- Post-Authentication Actions
- Field Validation Rules
- OAuth Providers
- Sessions
- Trusted Devices (2FA bypass)
- Compliance & Observability
- Common Presets
- Dynamic Configuration
Authentication
- ๐ Authentication โ Complete Guide
- ๐ Index
- Session Authenticator
- Per-User Account Lockout
- Compromised-Password Recheck on Login
- Access Token Authenticator
- JWT Authenticator
- JWT Refresh Tokens
- Magic Link Authentication
- Guest Authenticator
- Password Reset
- Force Password Reset
- Pre-Authentication Events
- Switching Between Authenticators
- Custom Authenticators
- Why HTTP Digest Auth is not supported
- OAuth 2.0 & Social Login
- ๐ TOTP Two-Factor Authentication
- ๐ฑ Device Sessions
- ๐ Table of Contents
- How It Works
- Configuration
- Database Migration
- Viewing Active Sessions
- Terminating Sessions
- Concurrent Session Limit
- Trusted Devices (2FA bypass)
- Login Activity Feed
- UserSecurityController Integration
- Building a Sessions Management Page
- New Device Login Notification
- Admin CLI
- Testing Device Sessions
- Security Tips
Controllers & Filters
Authorization & Logging
Compliance & Operations
Testing & Reference
- ๐งช Testing Guide
- ๐ Table of Contents
- ๐โโ๏ธ Quick Start
- ๐งช Test Categories
- ๐ง Test Setup
- ๐ก๏ธ Testing Authentication
- ๐ฅ Testing Authorization
- ๐๏ธ Testing Controllers
- ๐ Testing Filters
- ๐ Testing Models
- ๐๏ธ Testing Traits
- ๐ฏ Testing Best Practices
- ๐ Contributing Tests
- ๐ Related Documentation
- ๐ Migration Guide
Main Features๏
Authentication๏
Multiple Authenticators: Session, Access Token (with scope enforcement), JWT (with refresh tokens), Magic Link
TOTP Two-Factor Authentication with backup codes and optional โTrust this deviceโ bypass
Device Session Tracking with optional concurrent-session limit
Password Reset + Force Password Reset + optional rotation policy + history (no reuse)
OAuth 2.0 / Social Login: Google, GitHub, Facebook, Microsoft Azure, custom profile fields, OAuth events
Security๏
Per-User Account Lockout (atomic) โ independent of IP-based blocking
Compromised-Password Recheck on Login (HIBP integration, opt-in)
Suspicious Login Detection with
suspicious-loginevent for email alertsTiming-safe OAuth state validation
Compliance & Operations๏
Granular audit log (
auth_audit_logs) โ 22 canonical event types, filterable CLIGDPR helpers โ JSON data export + account anonymization
Admin CLI:
auth:tokens revoke,auth:sessions terminate,auth:totp reset,auth:audit,auth:gdpr export|anonymizeComplete Logging: CI4 Events + database login attempts + audit log
Highly Customizable: Extend or replace any component
Quick Start๏
composer require daycry/auth
php spark migrate --all
php spark auth:setup
// Login
$result = auth()->attempt(['email' => 'user@example.com', 'password' => 'secret']);
if ($result->isOK()) {
return redirect()->to('/dashboard');
}
Documentation Sections๏
Quick Start Guide๏
Install and configure Daycry Auth in minutes.
Configuration๏
Every configuration option explained with examples.
Authentication๏
Session, Access Token, JWT (with refresh), Magic Link, Password Reset, and more.
TOTP Two-Factor Authentication๏
Time-based OTP with authenticator apps.
Device Sessions๏
Track and manage active logins across devices.
Security Filters๏
Protect routes with authentication and authorization filters.
Controllers๏
All included controllers: Login, Register, Password Reset, Force Reset, JWT, UserSecurity.
Authorization๏
Groups, permissions, permission cache, and RBAC patterns.
Logging & Monitoring๏
CI4 Events, database logs, per-user lockout, and rate limiting.
Testing๏
Unit and integration testing with authentication mocking.
Additional Resources๏
GitHub: daycry/auth
CodeIgniter 4 Docs: codeigniter4.github.io
Packagist: packagist.org/packages/daycry/auth
Issues: github.com/daycry/auth/issues