Add independent administrative authentication foundation

This commit is contained in:
2026-10-26 12:51:42 +00:00
parent fdeff5b898
commit d11c4a868e
6 changed files with 814 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import {
readAdminSessionCookie,
setAdminAuthNoStore,
validateAdminSession
} from "../../../../lib/admin/adminAuth";
import { respondError, respondSuccess } from "../../middleware/apiResponse";
export default async function handler(req, res) {
setAdminAuthNoStore(res);
res.setHeader("Allow", "GET");
if (req.method !== "GET") {
return respondError(res, {
status: 405,
code: "METHOD_NOT_ALLOWED",
message: "Method not allowed"
});
}
const token = readAdminSessionCookie(req);
return respondSuccess(res, {
authenticated: validateAdminSession(token)
});
}