Basic Authentication for Vantage.js

1.0.0 · abandoned · verified Wed Apr 22

vantage-auth-basic is an authentication extension designed for the vantage.js interactive CLI framework. It provides basic authentication capabilities, prompting users for usernames and passwords configured on the Vantage server. Key features include configurable retry limits for incorrect password attempts, a delay between retries, and an account lockout mechanism with a specified unlock timeout. As of version 1.0.0, this extension is tightly integrated with vantage.js and is often used by simply specifying the string "basic" in the vantage.auth() method, negating the need for a separate `require()` call when used within a Vantage application. Given the vantage.js framework's last significant activity being several years ago, this package is effectively abandoned and not recommended for new projects.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to configure basic authentication with `vantage-auth-basic` for a Vantage.js instance, defining users, retry policies, and an example command that accesses the authenticated user's information.

var users = [
	{ user: "admin", pass: "4k#842jx!%s" },
	{ user: "user", pass: "Unicorn11" }
];

var vantage = require("vantage")();

vantage.auth("basic", {
	"users": users,
  "retry": 3,
  "retryTime": 500,
  "deny": 1,
  "unlockTime": 3000
});

vantage
  .command("whoami", "Outputs logged in user.")
  .action(function(args, cb){
  	console.log("You are " + this.user);
  	cb();
  });

// To make the Vantage instance active, you would typically call .listen() or similar.
// For example, vantage.listen(4000) or run it from the command line if installed globally.
// This snippet primarily demonstrates the authentication setup.

view raw JSON →