(appId)
| 495 | } |
| 496 | |
| 497 | export function handleParseAuth(appId) { |
| 498 | return async (req, res, next) => { |
| 499 | const mount = getMountForRequest(req); |
| 500 | const config = Config.get(appId, mount); |
| 501 | if (!config) { |
| 502 | return next(); |
| 503 | } |
| 504 | req.config = config; |
| 505 | const clientIp = getClientIp(req); |
| 506 | req.config.ip = clientIp; |
| 507 | await config.loadKeys(); |
| 508 | const resolved = await resolveKeyAuth({ |
| 509 | config, |
| 510 | keyValue: req.get('X-Parse-Master-Key') || null, |
| 511 | maintenanceKeyValue: req.get('X-Parse-Maintenance-Key') || null, |
| 512 | installationId: req.get('X-Parse-Installation-Id') || 'cloud', |
| 513 | clientIp, |
| 514 | }); |
| 515 | if (resolved) { |
| 516 | req.auth = resolved; |
| 517 | } |
| 518 | return next(); |
| 519 | }; |
| 520 | } |
| 521 | |
| 522 | export function handleParseHealth(options) { |
| 523 | return (req, res) => { |
nothing calls this directly
no test coverage detected