
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600× Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
basic-authentication
Advanced tools
Basic authentication is method for a HTTP user agent to provide a user name and password.
Install through NPM
npm install basic-authentication
or
git clone git://github.com/hex7c0/basic-authentication.git
inside expressjs project like a middleware
var authentication = require('basic-authentication')();
var app = require('express')();
app.use(authentication);
inside expressjs project like a callback for certain route
var authentication = require('basic-authentication')();
var app = require('express')();
app.get('/', authentication, function(req, res) {
res.send('ok');
});
inside routing like a function
var authentication = require('basic-authentication')({functions: true});
var app = require('express')();
app.get('/', function(req, res) {
var user = authentication(req);
if (user == 'foo') {
res.send('ok');
} else {
res.send('ko');
}
});
user
- String User for web basic access authentication (default "admin")password
- String Password for web basic access authentication (default "password")file
- String Path of htpasswd file (default "disabled")hash
- String Type of hash inside your htpasswd file (default "md5")agent
- String Browser User Agent for web authentication (default "all accepted")realm
- String Realm for web authentication (default "Authorization required")ending
- Boolean Flag for send res.end
(response) to client after error or wrong password (not in "functions" mode) (default "true")functions
- Boolean Flag for using module like a function (default "false")legacy
- Boolean Flag for using module like a function that return an Object (default "false")suppress
- Boolean Suppress all routing error (default "false")in functions
mode, it return a Base64 String; otherwise, if some errors occurred, return an Empty String
in legacy
mode, it return an Object {user, password}
; otherwise, if some errors occurred, return an Empty Object
Take a look at my examples
FAQs
http basic authentication
The npm package basic-authentication receives a total of 807 weekly downloads. As such, basic-authentication popularity was classified as not popular.
We found that basic-authentication demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.