Daycry Auth¶
Authentication & Authorization for CodeIgniter 4 — Session, Access Token, JWT, OAuth, TOTP and WebAuthn / Passkeys, with a full RBAC authorization system. Batteries included, secure by default.
Features¶
-
Multiple authenticators
Session, Access Token (with scope enforcement), JWT (refresh tokens + one-shot revocation via
token_version), and Magic Link (email link or 6-digit code) — all behind one helper. -
WebAuthn / Passkeys
Passwordless login (usernameless/discoverable) and passkey 2FA. Phishing-resistant by design, opt-in per user behind a global flag.
-
TOTP two-factor
RFC 6238 TOTP with backup codes, "trust this device" bypass, per-user brute-force lockout, and single-use anti-replay codes.
-
OAuth 2.0 / Social
Google, GitHub, Facebook, Microsoft Azure and any OIDC provider. Profile fields, OAuth events, explicit account linking and verified-email merge safety.
-
RBAC authorization
Groups & permissions with optional cache, uniform wildcard matching (
posts.*), and a Gate → RBAC bridge. Plus filters: group, permission, gate, token-scope. -
Device sessions
Track active logins per device, optional concurrent-session limit, and real enforced revocation — a revoked session must re-authenticate on its next request.
-
Filters & rate limiting
Per-route rate limits (
rates:<limit>,<period>) and sudo mode (password-confirm:<seconds>) that override global windows on your most sensitive routes. -
Audit & compliance
Granular audit log (22 event types), GDPR export/anonymize helpers, and an admin CLI for tokens, sessions, TOTP, audit and scheduled purges.
Quick start¶
Security, by default¶
-
Hardened auth
Per-user atomic lockout, compromised-password recheck (HIBP), suspicious-login & remember-me theft detection, and a secret-safe login log (SHA-256 fingerprints, never raw tokens).
-
Customizable
Swap or extend any component — authenticators, repositories, views, actions and policies are all resolvable services you can override.
-
Tested
A large PHPUnit suite (incl. a real in-test WebAuthn authenticator), PHPStan level 5, deptrac and Rector keep the library correct and clean.