{"_id":"basic-auth","_rev":"55695","name":"basic-auth","description":"node.js basic auth parser","dist-tags":{"latest":"2.0.1"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"},{"name":"dougwilson","email":""},{"name":"jonathanong","email":""},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"ulisesgascon","email":""}],"time":{"modified":"2021-06-03T10:16:57.000Z","created":"2013-11-30T19:20:06.195Z","2.0.1":"2018-09-20T03:26:02.582Z","2.0.0":"2017-09-13T04:11:36.377Z","1.1.0":"2016-11-18T18:57:06.779Z","1.0.4":"2016-05-11T03:54:40.196Z","1.0.3":"2015-07-02T04:45:20.715Z","1.0.2":"2015-06-13T03:51:35.314Z","1.0.1":"2015-05-05T05:54:12.251Z","1.0.0":"2014-07-07T00:19:25.361Z","0.0.1":"2013-11-30T19:20:06.195Z"},"users":{"mikend":true,"pdilyard":true,"sanketss84":true,"justintormey":true,"melliw":true,"markthethomas":true,"fabian.moron.zirfas":true,"hckhanh":true,"hyteer":true,"ghkddbguse":true,"sammok2003":true,"garrickajo":true,"j.su":true,"hifaraz":true,"mikermcneil":true,"dburdese":true,"tfentonz":true,"iori20091101":true,"mobeicaoyuan":true,"bobjohnson23":true,"langri-sha":true,"tmurngon":true,"3creatives":true,"izzy":true,"artmadiar":true,"serge-nikitin":true,"icerainnuaa":true,"quafoo":true,"garenyondem":true,"jaguarj":true,"leonardorb":true,"tomchao":true,"rocket0191":true,"gavinning":true,"monjer":true,"cooboor":true,"hugojosefson":true,"mucahitnezir":true,"xuu":true,"im_dodo":true,"rowantaubitz":true,"josudoey":true,"archibinario":true,"maxblock":true,"drveresh":true},"repository":{"type":"git","url":"git+https://github.com/jshttp/basic-auth.git"},"versions":{"2.0.1":{"name":"basic-auth","description":"node.js basic auth parser","version":"2.0.1","license":"MIT","keywords":["basic","auth","authorization","basicauth"],"repository":{"type":"git","url":"git+https://github.com/jshttp/basic-auth.git"},"dependencies":{"safe-buffer":"5.1.2"},"devDependencies":{"eslint":"5.6.0","eslint-config-standard":"12.0.0","eslint-plugin-import":"2.14.0","eslint-plugin-markdown":"1.0.0-beta.6","eslint-plugin-node":"7.0.1","eslint-plugin-promise":"4.0.1","eslint-plugin-standard":"4.0.0","istanbul":"0.4.5","mocha":"5.2.0"},"engines":{"node":">= 0.8"},"scripts":{"lint":"eslint --plugin markdown --ext js,md .","test":"mocha --check-leaks --reporter spec --bail","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"gitHead":"bde0bac8ba99f5d461a339cb6b8a598a0586d699","bugs":{"url":"https://github.com/jshttp/basic-auth/issues"},"homepage":"https://github.com/jshttp/basic-auth#readme","_id":"basic-auth@2.0.1","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"dist":{"shasum":"b998279bf47ce38344b4f3cf916d4679bbf51e3a","size":3744,"noattachment":false,"key":"/basic-auth/-/basic-auth-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/basic-auth/download/basic-auth-2.0.1.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"},{"name":"dougwilson","email":""},{"name":"jonathanong","email":""},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"ulisesgascon","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/basic-auth_2.0.1_1537413962464_0.07525772488456206"},"_hasShrinkwrap":false,"publish_time":1537413962582,"_cnpm_publish_time":1537413962582},"2.0.0":{"name":"basic-auth","description":"node.js basic auth parser","version":"2.0.0","license":"MIT","keywords":["basic","auth","authorization","basicauth"],"repository":{"type":"git","url":"git+https://github.com/jshttp/basic-auth.git"},"dependencies":{"safe-buffer":"5.1.1"},"devDependencies":{"eslint":"3.19.0","eslint-config-standard":"10.2.1","eslint-plugin-import":"2.7.0","eslint-plugin-markdown":"1.0.0-beta.6","eslint-plugin-node":"5.1.1","eslint-plugin-promise":"3.5.0","eslint-plugin-standard":"3.0.1","istanbul":"0.4.5","mocha":"2.5.3"},"files":["HISTORY.md","LICENSE","index.js"],"engines":{"node":">= 0.8"},"scripts":{"lint":"eslint --plugin markdown --ext js,md .","test":"mocha --check-leaks --reporter spec --bail","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"gitHead":"704457317b54809b750274cc794d05d43cbb190c","bugs":{"url":"https://github.com/jshttp/basic-auth/issues"},"homepage":"https://github.com/jshttp/basic-auth#readme","_id":"basic-auth@2.0.0","_shasum":"015db3f353e02e56377755f962742e8981e7bbba","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.1","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"dist":{"shasum":"015db3f353e02e56377755f962742e8981e7bbba","size":3586,"noattachment":false,"key":"/basic-auth/-/basic-auth-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/basic-auth/download/basic-auth-2.0.0.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"},{"name":"dougwilson","email":""},{"name":"jonathanong","email":""},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"ulisesgascon","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/basic-auth-2.0.0.tgz_1505275895449_0.5881294559221715"},"directories":{},"publish_time":1505275896377,"_hasShrinkwrap":false,"_cnpm_publish_time":1505275896377},"1.1.0":{"name":"basic-auth","description":"node.js basic auth parser","version":"1.1.0","license":"MIT","keywords":["basic","auth","authorization","basicauth"],"repository":{"type":"git","url":"https://github.com/jshttp/basic-auth"},"devDependencies":{"eslint":"3.10.2","eslint-config-standard":"6.2.1","eslint-plugin-markdown":"1.0.0-beta.3","eslint-plugin-promise":"3.4.0","eslint-plugin-standard":"2.0.1","istanbul":"0.4.5","mocha":"1.21.5"},"files":["HISTORY.md","LICENSE","index.js"],"engines":{"node":">= 0.6"},"scripts":{"lint":"eslint --plugin markdown --ext js,md .","test":"mocha --check-leaks --reporter spec --bail","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"gitHead":"5a0fcd9f4dbf72e2a105d4e815987d3492925875","bugs":{"url":"https://github.com/jshttp/basic-auth/issues"},"homepage":"https://github.com/jshttp/basic-auth","_id":"basic-auth@1.1.0","_shasum":"45221ee429f7ee1e5035be3f51533f1cdfd29884","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"},{"name":"dougwilson","email":""},{"name":"jonathanong","email":""},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"ulisesgascon","email":""}],"dist":{"shasum":"45221ee429f7ee1e5035be3f51533f1cdfd29884","size":3471,"noattachment":false,"key":"/basic-auth/-/basic-auth-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/basic-auth/download/basic-auth-1.1.0.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/basic-auth-1.1.0.tgz_1479495426183_0.6680189804174006"},"directories":{},"publish_time":1479495426779,"_cnpm_publish_time":1479495426779,"_hasShrinkwrap":false},"1.0.4":{"name":"basic-auth","description":"node.js basic auth parser","version":"1.0.4","license":"MIT","keywords":["basic","auth","authorization","basicauth"],"repository":{"type":"git","url":"git+https://github.com/jshttp/basic-auth.git"},"devDependencies":{"istanbul":"0.4.3","mocha":"1.21.5"},"files":["HISTORY.md","LICENSE","index.js"],"engines":{"node":">= 0.6"},"scripts":{"test":"mocha --check-leaks --reporter spec --bail","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"gitHead":"4682d99600383bad5a266efbaa5055657dd9891d","bugs":{"url":"https://github.com/jshttp/basic-auth/issues"},"homepage":"https://github.com/jshttp/basic-auth#readme","_id":"basic-auth@1.0.4","_shasum":"030935b01de7c9b94a824b29f3fccb750d3a5290","_from":".","_npmVersion":"2.15.1","_nodeVersion":"4.4.3","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"dist":{"shasum":"030935b01de7c9b94a824b29f3fccb750d3a5290","size":3000,"noattachment":false,"key":"/basic-auth/-/basic-auth-1.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/basic-auth/download/basic-auth-1.0.4.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"},{"name":"dougwilson","email":""},{"name":"jonathanong","email":""},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"ulisesgascon","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/basic-auth-1.0.4.tgz_1462938878912_0.717464140150696"},"directories":{},"publish_time":1462938880196,"_cnpm_publish_time":1462938880196,"_hasShrinkwrap":false},"1.0.3":{"name":"basic-auth","description":"node.js basic auth parser","version":"1.0.3","license":"MIT","keywords":["basic","auth","authorization","basicauth"],"repository":{"type":"git","url":"https://github.com/jshttp/basic-auth"},"devDependencies":{"istanbul":"0.3.17","mocha":"1.21.5"},"files":["HISTORY.md","LICENSE","index.js"],"engines":{"node":">= 0.6"},"scripts":{"test":"mocha --check-leaks --reporter spec --bail","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"gitHead":"eec1944e5a54c907676822096d40bc7c52c0aff3","bugs":{"url":"https://github.com/jshttp/basic-auth/issues"},"homepage":"https://github.com/jshttp/basic-auth","_id":"basic-auth@1.0.3","_shasum":"41f55523e589405038ee3567958c62a5ed70551a","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"},{"name":"dougwilson","email":""},{"name":"jonathanong","email":""},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"ulisesgascon","email":""}],"dist":{"shasum":"41f55523e589405038ee3567958c62a5ed70551a","size":2904,"noattachment":false,"key":"/basic-auth/-/basic-auth-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/basic-auth/download/basic-auth-1.0.3.tgz"},"directories":{},"publish_time":1435812320715,"_cnpm_publish_time":1435812320715,"_hasShrinkwrap":false},"1.0.2":{"name":"basic-auth","description":"node.js basic auth parser","version":"1.0.2","license":"MIT","keywords":["basic","auth","authorization","basicauth"],"repository":{"type":"git","url":"https://github.com/jshttp/basic-auth"},"devDependencies":{"istanbul":"0.3.15","mocha":"1.21.5"},"files":["HISTORY.md","LICENSE","index.js"],"engines":{"node":">= 0.6"},"scripts":{"test":"mocha --check-leaks --reporter spec --bail","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"gitHead":"5e2d7ef5bad393e17ed0035f4926846137559260","bugs":{"url":"https://github.com/jshttp/basic-auth/issues"},"homepage":"https://github.com/jshttp/basic-auth","_id":"basic-auth@1.0.2","_shasum":"42900137fb0c91462d14b3739c14bf2bb624171d","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"},{"name":"dougwilson","email":""},{"name":"jonathanong","email":""},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"ulisesgascon","email":""}],"dist":{"shasum":"42900137fb0c91462d14b3739c14bf2bb624171d","size":2876,"noattachment":false,"key":"/basic-auth/-/basic-auth-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/basic-auth/download/basic-auth-1.0.2.tgz"},"directories":{},"publish_time":1434167495314,"_cnpm_publish_time":1434167495314,"_hasShrinkwrap":false},"1.0.1":{"name":"basic-auth","description":"node.js basic auth parser","version":"1.0.1","license":"MIT","keywords":["basic","auth","authorization","basicauth"],"repository":{"type":"git","url":"git+https://github.com/jshttp/basic-auth.git"},"devDependencies":{"istanbul":"0.3.13","mocha":"~2.2.4"},"files":["HISTORY.md","LICENSE","index.js"],"engines":{"node":">= 0.8"},"scripts":{"test":"mocha --check-leaks --reporter spec --bail","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"},"gitHead":"0eea397ee77a5170c196d031d0038c2506301f27","bugs":{"url":"https://github.com/jshttp/basic-auth/issues"},"homepage":"https://github.com/jshttp/basic-auth#readme","_id":"basic-auth@1.0.1","_shasum":"4bae1dbfbf0aec4dc5dc47a8d3675b50140f3bf8","_from":".","_npmVersion":"2.9.0","_nodeVersion":"2.0.0","_npmUser":{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},"dist":{"shasum":"4bae1dbfbf0aec4dc5dc47a8d3675b50140f3bf8","size":2308,"noattachment":false,"key":"/basic-auth/-/basic-auth-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/basic-auth/download/basic-auth-1.0.1.tgz"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"},{"name":"dougwilson","email":""},{"name":"jonathanong","email":""},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"ulisesgascon","email":""}],"directories":{},"publish_time":1430805252251,"_cnpm_publish_time":1430805252251,"_hasShrinkwrap":false},"1.0.0":{"name":"basic-auth","version":"1.0.0","repository":{"type":"git","url":"https://github.com/visionmedia/node-basic-auth"},"description":"generic basic auth parser","keywords":["basic","auth","authorization","basicauth"],"devDependencies":{"mocha":"*","should":"*"},"scripts":{"test":"make test"},"files":["index.js"],"license":"MIT","gitHead":"099e8c703ea3994d72240492aba9b115517cf45e","bugs":{"url":"https://github.com/visionmedia/node-basic-auth/issues"},"homepage":"https://github.com/visionmedia/node-basic-auth","_id":"basic-auth@1.0.0","_shasum":"111b2d9ff8e4e6d136b8c84ea5e096cb87351637","_from":".","_npmVersion":"1.4.16","_npmUser":{"name":"jonathanong","email":"jonathanrichardong@gmail.com"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"},{"name":"dougwilson","email":""},{"name":"jonathanong","email":""},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"ulisesgascon","email":""}],"dist":{"shasum":"111b2d9ff8e4e6d136b8c84ea5e096cb87351637","size":905,"noattachment":false,"key":"/basic-auth/-/basic-auth-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/basic-auth/download/basic-auth-1.0.0.tgz"},"directories":{},"publish_time":1404692365361,"_cnpm_publish_time":1404692365361,"_hasShrinkwrap":false},"0.0.1":{"name":"basic-auth","version":"0.0.1","repository":{"type":"git","url":"git://github.com/visionmedia/node-basic-auth"},"description":"generic basic auth parser","keywords":["basic","auth","authorization","basicauth"],"dependencies":{},"devDependencies":{"mocha":"*","should":"*"},"license":"MIT","readmeFilename":"Readme.md","bugs":{"url":"https://github.com/visionmedia/node-basic-auth/issues"},"homepage":"https://github.com/visionmedia/node-basic-auth","_id":"basic-auth@0.0.1","dist":{"shasum":"31ddb65843f6c35c6fea7beb46a987cb8ce18924","size":1278,"noattachment":false,"key":"/basic-auth/-/basic-auth-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/basic-auth/download/basic-auth-0.0.1.tgz"},"_from":".","_npmVersion":"1.3.15","_npmUser":{"name":"tjholowaychuk","email":"tj@vision-media.ca"},"maintainers":[{"name":"blakeembrey","email":"hello@blakeembrey.com"},{"name":"dougwilson","email":""},{"name":"jonathanong","email":""},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"ulisesgascon","email":""}],"directories":{},"publish_time":1385839206195,"_cnpm_publish_time":1385839206195,"_hasShrinkwrap":false}},"readme":"# basic-auth\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Node.js Version][node-version-image]][node-version-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nGeneric basic auth Authorization header field parser for whatever.\n\n## Installation\n\nThis is a [Node.js](https://nodejs.org/en/) module available through the\n[npm registry](https://www.npmjs.com/). Installation is done using the\n[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):\n\n```\n$ npm install basic-auth\n```\n\n## API\n\n<!-- eslint-disable no-unused-vars -->\n\n```js\nvar auth = require('basic-auth')\n```\n\n### auth(req)\n\nGet the basic auth credentials from the given request. The `Authorization`\nheader is parsed and if the header is invalid, `undefined` is returned,\notherwise an object with `name` and `pass` properties.\n\n### auth.parse(string)\n\nParse a basic auth authorization header string. This will return an object\nwith `name` and `pass` properties, or `undefined` if the string is invalid.\n\n## Example\n\nPass a Node.js request object to the module export. If parsing fails\n`undefined` is returned, otherwise an object with `.name` and `.pass`.\n\n<!-- eslint-disable no-unused-vars, no-undef -->\n\n```js\nvar auth = require('basic-auth')\nvar user = auth(req)\n// => { name: 'something', pass: 'whatever' }\n```\n\nA header string from any other location can also be parsed with\n`auth.parse`, for example a `Proxy-Authorization` header:\n\n<!-- eslint-disable no-unused-vars, no-undef -->\n\n```js\nvar auth = require('basic-auth')\nvar user = auth.parse(req.getHeader('Proxy-Authorization'))\n```\n\n### With vanilla node.js http server\n\n```js\nvar http = require('http')\nvar auth = require('basic-auth')\nvar compare = require('tsscmp')\n\n// Create server\nvar server = http.createServer(function (req, res) {\n  var credentials = auth(req)\n\n  // Check credentials\n  // The \"check\" function will typically be against your user store\n  if (!credentials || !check(credentials.name, credentials.pass)) {\n    res.statusCode = 401\n    res.setHeader('WWW-Authenticate', 'Basic realm=\"example\"')\n    res.end('Access denied')\n  } else {\n    res.end('Access granted')\n  }\n})\n\n// Basic function to validate credentials for example\nfunction check (name, pass) {\n  var valid = true\n\n  // Simple method to prevent short-circut and use timing-safe compare\n  valid = compare(name, 'john') && valid\n  valid = compare(pass, 'secret') && valid\n\n  return valid\n}\n\n// Listen\nserver.listen(3000)\n```\n\n# License\n\n[MIT](LICENSE)\n\n[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/basic-auth/master\n[coveralls-url]: https://coveralls.io/r/jshttp/basic-auth?branch=master\n[downloads-image]: https://badgen.net/npm/dm/basic-auth\n[downloads-url]: https://npmjs.org/package/basic-auth\n[node-version-image]: https://badgen.net/npm/node/basic-auth\n[node-version-url]: https://nodejs.org/en/download\n[npm-image]: https://badgen.net/npm/v/basic-auth\n[npm-url]: https://npmjs.org/package/basic-auth\n[travis-image]: https://badgen.net/travis/jshttp/basic-auth/master\n[travis-url]: https://travis-ci.org/jshttp/basic-auth\n","_attachments":{},"homepage":"https://github.com/jshttp/basic-auth#readme","bugs":{"url":"https://github.com/jshttp/basic-auth/issues"},"license":"MIT"}