feat(auth): enhance security and audit logging
- Integrate webhook alerts for admin login lockouts. - Implement detailed audit logging for login, logout, and setup actions. - Improve client revocation event tracking. - Standardize error handling in profile updates. - Enforce 'operator' role for event API access.
This commit is contained in:
1 parent
5c977d6977
commit
8132087085
52 files changed
+4434
-407
No files matched your search
@@ -3,6 +3,7 @@ import {
|
||||
getAdminSessionSecret,
|
||||
getSessionCookieOptions,
|
||||
} from "@/core/auth/adminSession";
|
||||
import { recordAdminAuditLogAsync } from "@/core/auth/auditLog";
|
||||
import {
|
||||
AdminDatabaseRequiredError,
|
||||
clearAdminLoginAttempts,
|
||||
@@ -128,6 +129,17 @@ export async function POST(request: NextRequest) {
|
||||
clientIp,
|
||||
).catch(() => undefined);
|
||||
|
||||
await recordAdminAuditLogAsync({
|
||||
actorEmail: email,
|
||||
actorRole: "owner",
|
||||
action: "ADMIN_SETUP",
|
||||
target: email,
|
||||
ipAddress: clientIp,
|
||||
metadata: {
|
||||
memberId: "owner-1",
|
||||
},
|
||||
});
|
||||
|
||||
const token = await createAdminSessionToken(
|
||||
email,
|
||||
sessionSecret,
|
||||
|
||||
Reference in new issue
Block a user