Spaces:
Sleeping
Sleeping
Download src/libs/shared/presentation/http/middleware/security/InternalSecretMiddleware.ts from fouadkhalid123/asd: direct link, hf CLI and curl.
- Browser
- Download file 414 Bytes
-
https://huggingface.co/spaces/fouadkhalid123/asd/resolve/main/src/libs/shared/presentation/http/middleware/security/InternalSecretMiddleware.ts
- Command line
-
hf download hf://spaces/fouadkhalid123/asd/src/libs/shared/presentation/http/middleware/security/InternalSecretMiddleware.ts
-
curl -L -o InternalSecretMiddleware.ts https://huggingface.co/spaces/fouadkhalid123/asd/resolve/main/src/libs/shared/presentation/http/middleware/security/InternalSecretMiddleware.ts
414 Bytes
| import { Request, Response, NextFunction } from "express"; | |
| import { env } from "../../../../../../config/env"; | |
| export function InternalSecretMiddleware(req: Request, res: Response, next: NextFunction): void { | |
| const secret = req.headers["x-internal-secret"]; | |
| if (!secret || secret !== env.N8N_INTERNAL_SECRET) { | |
| res.status(401).json({ error: "Unauthorized" }); | |
| return; | |
| } | |
| next(); | |
| } |