@thexjs/auth@3.0.0
·
33 commits
to main
since this release
Minor Changes
- f22aaae: Add role-based access control. Sessions now carry
roles/permissions(from the provider's user or a newresolveRoleshook ondefineAuth, snapshotted at session creation). New pure helpers (hasRole,hasAnyRole,hasPermission,hasAllPermissions), fail-closed guards (requireRole,requirePermission,requireAuth), and middleware adapters (toMiddleware, plusauth.requireRole(...)/auth.requirePermission(...)/auth.requireAuth()/auth.guard(...)) that plug into the framework's route middleware. Signed out → 401, authenticated but unauthorized → 403, optionalredirectTofor signed-out users.