{
  "name": "basic-auth",
  "description": "node.js basic auth parser",
  "version": "1.0.3",
  "license": "MIT",
  "keywords": [
    "basic",
    "auth",
    "authorization",
    "basicauth"
  ],
  "repository": {
    "type": "git",
    "url": "git://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/"
  },
  "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\n```\n$ npm install basic-auth\n```\n\n## API\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## Example\n\nPass a node request or koa Context object to the module exported. If\nparsing fails `undefined` is returned, otherwise an object with\n`.name` and `.pass`.\n\n```js\nvar auth = require('basic-auth');\nvar user = auth(req);\n// => { name: 'something', pass: 'whatever' }\n\n```\n\n### With vanilla node.js http server\n\n```js\nvar http = require('http')\nvar auth = require('basic-auth')\n\n// Create server\nvar server = http.createServer(function (req, res) {\n  var credentials = auth(req)\n\n  if (!credentials || credentials.name !== 'john' || credentials.pass !== 'secret') {\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// Listen\nserver.listen(3000)\n```\n\n# License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/basic-auth.svg\n[npm-url]: https://npmjs.org/package/basic-auth\n[node-version-image]: https://img.shields.io/node/v/basic-auth.svg\n[node-version-url]: http://nodejs.org/download/\n[travis-image]: https://img.shields.io/travis/jshttp/basic-auth/master.svg\n[travis-url]: https://travis-ci.org/jshttp/basic-auth\n[coveralls-image]: https://img.shields.io/coveralls/jshttp/basic-auth/master.svg\n[coveralls-url]: https://coveralls.io/r/jshttp/basic-auth?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/basic-auth.svg\n[downloads-url]: https://npmjs.org/package/basic-auth\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/jshttp/basic-auth/issues"
  },
  "homepage": "https://github.com/jshttp/basic-auth",
  "_id": "basic-auth@1.0.3",
  "dist": {
    "shasum": "b06fe8aa492650063bede14cb44f911b4a2f8be8"
  },
  "_from": "basic-auth@~1.0.3",
  "_resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-1.0.3.tgz"
}
