http-auth
Node.js package for HTTP basic and digest access authentication.
Last updated 12 years ago by gevorg .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install http-auth 
SYNC missed versions from official npm registry.

http-auth

Node.js package for HTTP basic and digest access authentication.

build

Installation

Via git (or downloaded tarball):

$ git clone git://github.com/gevorg/http-auth.git

Via npm:

$ npm install http-auth

Usage

// HTTP module
const http = require("http");

// Authentication module.
const auth = require("http-auth");
const basic = auth.basic({
  realm: "Simon Area.",
  file: __dirname + "/../data/users.htpasswd" // gevorg:gpass, Sarah:testpass
});

// Creating new HTTP server.
http
  .createServer(
    basic.check((req, res) => {
      res.end(`Welcome to private area - ${req.user}!`);
    })
  )
  .listen(1337, () => {
    // Log URL.
    console.log("Server running at http://127.0.0.1:1337/");
  });

Please check examples directory for more.

Configurations

  • realm - Authentication realm, by default it is Users.
  • file - File where user details are stored.
    • Line format is {user:pass} or {user:passHash} for basic access.
    • Line format is {user:realm:passHash} for digest access.
  • algorithm - Algorithm that will be used only for digest access authentication.
    • MD5 by default.
    • MD5-sess can be set.
  • qop - Quality of protection that is used only for digest access authentication.
    • auth is set by default.
    • none this option is disabling protection.
  • msg401 - Message for failed authentication 401 page.
  • msg407 - Message for failed authentication 407 page.
  • contentType - Content type for failed authentication page.
  • skipUser - Set this to true, if you don't want req.user to be filled with authentication info.
  • proxy - Set this to true, if you want to use it with http-proxy.

Running tests

It uses mocha, so just run following command in package directory:

$ npm test

Questions

You can also use stackoverflow to ask questions using http-auth tag.

Utilities

  • htpasswd - Node.js package for HTTP Basic Authentication password file utility.
  • htdigest - Node.js package for HTTP Digest Authentication password file utility.

Integrations

Please check this link for integration packages.

License

The MIT License (MIT)

Current Tags

  • 4.1.9                                ...           latest (5 years ago)

103 Versions

  • 4.1.9                                ...           5 years ago
  • 4.1.7                                ...           5 years ago
  • 4.1.6                                ...           5 years ago
  • 4.1.5                                ...           5 years ago
  • 4.1.4                                ...           5 years ago
  • 4.1.3                                ...           5 years ago
  • 4.1.2                                ...           6 years ago
  • 4.1.1                                ...           6 years ago
  • 4.1.0                                ...           6 years ago
  • 4.0.2                                ...           6 years ago
  • 4.0.1                                ...           6 years ago
  • 4.0.0                                ...           6 years ago
  • 3.2.4                                ...           7 years ago
  • 3.2.3                                ...           9 years ago
  • 3.1.3                                ...           9 years ago
  • 3.1.2                                ...           9 years ago
  • 3.1.1                                ...           9 years ago
  • 3.1.0                                ...           9 years ago
  • 3.0.1                                ...           9 years ago
  • 2.4.11                                ...           9 years ago
  • 3.0.0                                ...           9 years ago
  • 2.4.10                                ...           10 years ago
  • 2.4.9                                ...           10 years ago
  • 2.4.8                                ...           10 years ago
  • 2.4.7                                ...           10 years ago
  • 2.4.6                                ...           10 years ago
  • 2.4.5                                ...           10 years ago
  • 2.4.4                                ...           10 years ago
  • 2.4.3                                ...           10 years ago
  • 2.4.2                                ...           10 years ago
  • 2.4.1                                ...           10 years ago
  • 2.4.0                                ...           10 years ago
  • 2.3.9                                ...           10 years ago
  • 2.3.8                                ...           10 years ago
  • 2.3.7                                ...           10 years ago
  • 2.3.6                                ...           10 years ago
  • 2.3.5                                ...           10 years ago
  • 2.3.4                                ...           10 years ago
  • 2.3.3                                ...           10 years ago
  • 2.3.2                                ...           10 years ago
  • 2.3.1                                ...           10 years ago
  • 2.3.0                                ...           10 years ago
  • 2.2.9                                ...           10 years ago
  • 2.2.8                                ...           11 years ago
  • 2.2.7                                ...           11 years ago
  • 2.2.6                                ...           11 years ago
  • 2.2.5                                ...           11 years ago
  • 2.2.4                                ...           11 years ago
  • 2.2.3                                ...           11 years ago
  • 2.2.2                                ...           11 years ago
  • 2.2.1                                ...           11 years ago
  • 2.2.0                                ...           12 years ago
  • 2.1.9                                ...           12 years ago
  • 2.1.8                                ...           12 years ago
  • 2.1.7                                ...           12 years ago
  • 2.1.6                                ...           12 years ago
  • 2.1.5                                ...           12 years ago
  • 2.1.4                                ...           12 years ago
  • 2.1.3                                ...           12 years ago
  • 2.1.2                                ...           12 years ago
  • 2.1.1                                ...           12 years ago
  • 2.1.0                                ...           12 years ago
  • 2.0.9                                ...           12 years ago
  • 2.0.8                                ...           12 years ago
  • 2.0.7                                ...           12 years ago
  • 2.0.6                                ...           12 years ago
  • 2.0.5                                ...           13 years ago
  • 2.0.4                                ...           13 years ago
  • 2.0.3                                ...           13 years ago
  • 2.0.2                                ...           13 years ago
  • 2.0.1                                ...           13 years ago
  • 2.0.0                                ...           13 years ago
  • 1.3.0                                ...           13 years ago
  • 1.2.9                                ...           13 years ago
  • 1.2.8                                ...           13 years ago
  • 1.2.7                                ...           13 years ago
  • 1.2.6                                ...           13 years ago
  • 1.2.5                                ...           13 years ago
  • 1.2.4                                ...           13 years ago
  • 1.2.3                                ...           13 years ago
  • 1.2.2                                ...           14 years ago
  • 1.2.1                                ...           14 years ago
  • 1.2.0                                ...           14 years ago
  • 1.1.9                                ...           14 years ago
  • 1.1.8                                ...           14 years ago
  • 1.1.7                                ...           14 years ago
  • 1.1.6                                ...           14 years ago
  • 1.1.5                                ...           14 years ago
  • 1.1.4                                ...           14 years ago
  • 1.1.3                                ...           14 years ago
  • 1.1.2                                ...           14 years ago
  • 1.1.1                                ...           14 years ago
  • 1.1.0                                ...           14 years ago
  • 1.0.9                                ...           14 years ago
  • 1.0.8                                ...           15 years ago
  • 1.0.7                                ...           15 years ago
  • 1.0.6                                ...           15 years ago
  • 1.0.5                                ...           15 years ago
  • 1.0.4                                ...           15 years ago
  • 1.0.3                                ...           15 years ago
  • 1.0.2                                ...           15 years ago
  • 1.0.1                                ...           15 years ago
  • 1.0.0                                ...           15 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 2
Last Month 4
Dependencies (3)
Dev Dependencies (4)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |