{ "_args": [ [ { "raw": "basic-auth@~1.0.3", "scope": null, "escapedName": "basic-auth", "name": "basic-auth", "rawSpec": "~1.0.3", "spec": ">=1.0.3 <1.1.0", "type": "range" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/morgan" ] ], "_from": "basic-auth@>=1.0.3 <1.1.0", "_id": "basic-auth@1.0.4", "_inCache": true, "_location": "/basic-auth", "_nodeVersion": "4.4.3", "_npmOperationalInternal": { "host": "packages-16-east.internal.npmjs.com", "tmp": "tmp/basic-auth-1.0.4.tgz_1462938878912_0.717464140150696" }, "_npmUser": { "name": "dougwilson", "email": "doug@somethingdoug.com" }, "_npmVersion": "2.15.1", "_phantomChildren": {}, "_requested": { "raw": "basic-auth@~1.0.3", "scope": null, "escapedName": "basic-auth", "name": "basic-auth", "rawSpec": "~1.0.3", "spec": ">=1.0.3 <1.1.0", "type": "range" }, "_requiredBy": [ "/morgan" ], "_resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-1.0.4.tgz", "_shasum": "030935b01de7c9b94a824b29f3fccb750d3a5290", "_shrinkwrap": null, "_spec": "basic-auth@~1.0.3", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/morgan", "bugs": { "url": "https://github.com/jshttp/basic-auth/issues" }, "dependencies": {}, "description": "node.js basic auth parser", "devDependencies": { "istanbul": "0.4.3", "mocha": "1.21.5" }, "directories": {}, "dist": { "shasum": "030935b01de7c9b94a824b29f3fccb750d3a5290", "tarball": "https://registry.npmjs.org/basic-auth/-/basic-auth-1.0.4.tgz" }, "engines": { "node": ">= 0.6" }, "files": [ "HISTORY.md", "LICENSE", "index.js" ], "gitHead": "4682d99600383bad5a266efbaa5055657dd9891d", "homepage": "https://github.com/jshttp/basic-auth#readme", "keywords": [ "basic", "auth", "authorization", "basicauth" ], "license": "MIT", "maintainers": [ { "name": "dougwilson", "email": "doug@somethingdoug.com" }, { "name": "jonathanong", "email": "jonathanrichardong@gmail.com" }, { "name": "jongleberry", "email": "jonathanrichardong@gmail.com" }, { "name": "tjholowaychuk", "email": "tj@vision-media.ca" } ], "name": "basic-auth", "optionalDependencies": {}, "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]: https://nodejs.org/en/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", "repository": { "type": "git", "url": "git+https://github.com/jshttp/basic-auth.git" }, "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/" }, "version": "1.0.4" }