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

@nexum-ag/basic-auth-middleware

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nexum-ag/basic-auth-middleware

A configurable Basic Authentication Middleware for Express

  • 1.1.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Basic Auth Middleware (express)

A middleware for express to configure a basic authentication.

Features:

  • Basic Auth with Username, Password
  • Whitelist for Hosts
  • Whitelist for IP-addresses
  • Whitelist for IP-ranges
  • specified authentication for other hosts

Installation

npm -i -S @nexum-ag/basic-auth-middleware

Simple Example

const express = require('express');
const basicAuthMiddleware = require('@nexum-ag/basic-auth-middleware');
const app = express();

app.use(basicAuthMiddleware.default('test','test', {hostsWhitelist: ['localhost:3000']}));
app.get('/', (req, res) => {
  res.send('Huhu all (/)');
});

app.listen(3000, () => console.log('Listening to 3000'));

Configuration

OptionTypeDescriptionExample
ipAddressWhiteliststring[]disable basic auth for this ips['127.0.0.1', '192.168.0.2']
ipRangeWhiteliststring[]disable basic auth for all ip addresses in the range['10.10.0.0/16', '192.168.1.1/24']
hostsWhiteliststring[]disable basic auth for this hosts['localhost:3000', '127.0.0.1']
specificHostAuth{[key: string]: {username: string, password: string}}change username and password for the specific hosts{'google.de': { username: 'test', password: 'test' } }

Keywords

FAQs

Package last updated on 10 Mar 2023

Did you know?

Socket

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.

Install

Related posts

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