{"_id":"@bongione/express-auth-usertype-middleware","_rev":"3-b2f0ddbb32b7de79afd0f5cf8dedae32","name":"@bongione/express-auth-usertype-middleware","description":"Express middleware that provides authorization middleware in front of routes for normal, admin and sysadmin users","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@bongione/express-auth-usertype-middleware","version":"0.1.0","description":"Express middleware that provides authorization middleware in front of routes for normal, admin and sysadmin users","main":"lib/index.js","scripts":{"test":"mocha --compilers js:babel-register --recursive"},"repository":{"type":"git","url":"git+https://github.com/mindiply/express-auth-usertype-middleware.git"},"keywords":["express","passport","middleware"],"author":{"name":"Paolo Ferdinando Bongiovanni","email":"paolo.bongiovanni@mindiply.com"},"license":"\tApache-2.0","bugs":{"url":"https://github.com/mindiply/express-auth-usertype-middleware/issues"},"homepage":"https://github.com/mindiply/express-auth-usertype-middleware#readme","devDependencies":{"babel-register":"^6.18.0","chai":"^3.5.0","mocha":"^3.1.2"},"gitHead":"a035e16aa574089cd993e206f467af156392b615","_id":"@bongione/express-auth-usertype-middleware@0.1.0","_shasum":"53d74194ad07170a93b2ed8b26ebc0fbba21a091","_from":".","_npmVersion":"3.10.6","_nodeVersion":"6.2.2","_npmUser":{"name":"bongione","email":"paolo.bongiovanni@mindiply.com"},"dist":{"shasum":"53d74194ad07170a93b2ed8b26ebc0fbba21a091","tarball":"https://registry.npmjs.org/@bongione/express-auth-usertype-middleware/-/express-auth-usertype-middleware-0.1.0.tgz","integrity":"sha512-PxFcUVL2T2PQrV7LsQ4ZZKZmM2AXoww9QGZB3Aojq/8aaoy6ejkmXdl4OZhytwM3qw1LeDY4f8KJZD/IuiW44w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAZ5+BO+6oqEl+iRpjLLLiYtpSUkeLNiUnmWCuBmNUGJAiAG2+vsNRimkZ64aebOgAsswyxqFnr+ulEsPgjfSRlXpA=="}]},"maintainers":[{"name":"bongione","email":"paolo.bongiovanni@mindiply.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/express-auth-usertype-middleware-0.1.0.tgz_1477912473409_0.6484415421728045"}}},"readme":"# express-auth-usertype-middleware\n\nSimple middleware that returns a 403 error when a user is not authenticated to the required level of security.\n\nThe library offers three levels of check: authenticated users, admin users and sysadmin users.\n\n\n# Usage\n\n~~~\n\nfunction isReqAuthenticated(req) { ... }\nfunction isReqAdminAuthenticated(req) { ... }\nfunction isReqSysAdminAuthenticated(req) { ... }\n\nlet { onlyAuthenticatedUsers, onlyAdminUsers, onlySysAdminUsers } = \n    require('@bongione/express-auth-usertype-middleware')({\n        isAuthenticatedUser : isReqAuthenticated,\n        isAdminUser : isReqAdminAuthenticated,\n        isSysAdminUser : isReqSysAdminAuthenticated\n    })    \n    \napp.use('/my_protected_routes', onlyAuthenticatedUsers, protected_routes_router)\napp.use('/my_admin_routes', onlyAdminUsers, admin_routes_router)\napp.use('/my_sysadmin_routes', onlySysAdminUsers, sysadmin_routes_router)\n~~~\n\n\nThe default implementation of *isAuthenticatedUser* uses the passport\nreq.isAuthenticated function.\n \nThe default implementations of isAdminUser and isSysAdminUser instead are\nspecific to Mindiply and ought to be customized.\n  \n\n# License\n\nApache 2.0","maintainers":[{"name":"bongione","email":"paolo.bongiovanni@mindiply.com"}],"time":{"modified":"2022-06-12T15:25:34.848Z","created":"2016-10-31T11:14:35.224Z","0.1.0":"2016-10-31T11:14:35.224Z"},"homepage":"https://github.com/mindiply/express-auth-usertype-middleware#readme","keywords":["express","passport","middleware"],"repository":{"type":"git","url":"git+https://github.com/mindiply/express-auth-usertype-middleware.git"},"author":{"name":"Paolo Ferdinando Bongiovanni","email":"paolo.bongiovanni@mindiply.com"},"bugs":{"url":"https://github.com/mindiply/express-auth-usertype-middleware/issues"},"license":"\tApache-2.0","readmeFilename":"README.md"}