Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

basic

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basic - npm Package Compare versions

Comparing version 0.0.3 to 1.0.0

.eslintrc

24

lib/index.js

@@ -0,16 +1,10 @@

var parser = require('./parser');
/**
* HTTP Basic Auth for Node.js
* HTTP Basic Auth middleware provider.
*
* @package basic
* @author Andrew Sliwinski <andrew@diy.org>
* @param {function} handler Function used to evaluate username & password
*
* @return {function}
*/
/**
* Dependencies
*/
var basic = require('./basic');
/**
* Export
*/
module.exports = function (handler) {

@@ -28,10 +22,10 @@ // Default handler method

if (!header) {
var denied = new Error('access denied')
denied.status = denied.statusCode = 401
var denied = new Error('access denied');
denied.status = denied.statusCode = 401;
return callback(denied);
}
var auth = basic(header);
var auth = parser(header);
handler(auth.username, auth.password, callback);
};
};

@@ -5,3 +5,3 @@ {

"description": "HTTP Basic Auth for Node.js",
"version": "0.0.3",
"version": "1.0.0",
"homepage": "https://github.com/thisandagain/basic",

@@ -19,5 +19,4 @@ "license": "MIT",

"devDependencies": {
"codebux": "~0.1.2",
"jshint-tap-simple": "~1.0.2",
"tap": "~0.3.1"
"eslint": "1.10.3",
"tap": "2.3.3"
},

@@ -24,0 +23,0 @@ "optionalDependencies": {},

@@ -11,6 +11,6 @@ ## basic

```javascript
var basic = require('basic'),
http = require('http');
var http = require('http');
var basic = require('../../lib/index');
var auth = basic(function (user, pass, callback) {
var auth = basic(function (user, pass, callback) {
if (user === 'let' && pass === 'me in') return callback(null);

@@ -17,0 +17,0 @@ callback(401);

@@ -1,6 +0,5 @@

var basic = require('../../lib/index'),
http = require('http');
var http = require('http');
var basic = require('../../lib/index');
var auth = basic(function (user, pass, callback) {
var auth = basic(function (user, pass, callback) {
if (user === 'let' && pass === 'me in') return callback(null);

@@ -12,5 +11,8 @@ callback(401);

auth(req, res, function (err) {
res.writeHead(err || 200);
var head = {};
if (err) head = {'WWW-Authenticate': 'Basic realm="Secure Area"'};
res.writeHead(err || 200, head);
res.end();
});
}).listen(8000);
}).listen(8000);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc