MCPcopy Create free account
hub / github.com/Rfym21/Qwen2API / adminKeyVerify

Function adminKeyVerify

src/middlewares/authorization.js:43–54  ·  view source on GitHub ↗
(req, res, next)

Source from the content-addressed store, hash-verified

41 error: { type: 'authentication_error', message: 'Invalid API key' }
42 })
43 }
44 return res.status(401).json({ error: 'Unauthorized' })
45 }
46
47 // 将权限信息附加到请求对象
48 req.isAdmin = isAdmin
49 req.apiKey = apiKey
50 next()
51}
52
53/**
54 * 管理员权限验证中间件 - 只允许管理员API Key
55 */
56const adminKeyVerify = (req, res, next) => {
57 const apiKey = req.headers['authorization'] || req.headers['Authorization'] || req.headers['x-api-key']

Callers

nothing calls this directly

Calls 1

validateApiKeyFunction · 0.85

Tested by

no test coverage detected