sap-cf-features
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -90,3 +90,5 @@ "use strict"; | ||
function getDomain(req) { | ||
return req.authInfo ? req.authInfo.subdomain : ""; | ||
// when using passport req.authInfo will contain tenant info. | ||
// when using the approuter, req.user.tenant is containing the tenant id. | ||
return req.authInfo ? req.authInfo.subdomain : req.user ? req.user.tenant : ""; | ||
} | ||
@@ -104,2 +106,10 @@ function respond(res, next, result, status = 200) { | ||
} | ||
router.use(function checkAuth(req, res, next) { | ||
//@ts-ignore | ||
if (!req.authInfo && !req.user) { | ||
res.statusCode = 401; | ||
res.end('Unauthorized'); | ||
} | ||
next(); | ||
}); | ||
router.get('/:flagName', (req, res, next) => __awaiter(this, void 0, void 0, function* () { | ||
@@ -106,0 +116,0 @@ //@ts-ignore |
{ | ||
"name": "sap-cf-features", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Read SAP CF feature flags in nodejs", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
17369
342