Skip to content
/ http-auth2 Public
forked from gevorg/http-auth

Utility that is creating HTTP server with basic authentication.

License

Notifications You must be signed in to change notification settings

SDA/http-auth2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http-auth

HTTP server with basic authentication.

Installation

Via git (or downloaded tarball):

$ git clone git://github.com/SDA/http-auth2.git

Via npm:

$ npm install http-auth2

Usage

var httpAuth = require('http-auth2');
httpAuth.createServer(function(username) {
	// Multiple username/password combinations are supported.
	if (username == 'user1') return 'password1';
	if (username == 'user2') return 'password2';
	return false;
}, function (request, response) {
	response.writeHead(200, {'Content-Type': 'text/html'});
	response.end("<pre>If you can read this, you've authenticated successfully.</pre>");
}).listen(8000);

Server startup params

  • auth - Authentication callback that accepts a username and returns the password for that user, or false if that user account is invalid.
  • callback - Callback function that will be called after server starts.

Acknowledgments

Based on work by Gevorg Harutyunyan: https://github.com/gevorg/http-auth

License

The GPL version 3, read it at http://www.gnu.org/licenses/gpl.txt

About

Utility that is creating HTTP server with basic authentication.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%