
Product
Introducing Webhook Events for Pull Request Scans
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
authmaker-verify-express
Advanced tools
This package allows you to use Authmaker verify extremely easily in an ExpressJS based Node application.
npm install --save authmaker-verify-express
This package currently makes use of the Mongo connection for Authmaker Verify so you need to initialise the database connection before use:
var authmakerVerify = require('authmaker-verify');
authmakerVerify.connectMongo(nconf);
You need to pass a nconf object into the connectMongo call that has access to at least the following parameters:
{
"mongo": {
"authmaker": {
"db": "your-db-name",
"host": "localhost",
"port": 27017
}
}
}
you can also optionally include username
and password
. Each of these config entries are accessed asynchronously so you can use any of the asynchronous stores for nconf
To actually use this package you just need to include middlewares in your ExpressJS app. Here are a few examples of ways you can use authmaker-verify-express. Please note that all of these examples use a simple "success" callback that does nothing but responds with a 200 response code. They have also already imported required modules:
var authmakerVerifyExpress = require('authmaker-verify-express');
var express = require('express');
var app = express();
function success(req, res){
return res.send("Success");
}
Requires users with valid, in date access tokens in the request:
app.get('/verify': [authmakerVerifyExpress.mongo(), success]);
Requires users with valid, in date access tokens with the scope "my_awesome_permission":
app.get('/scope': [authmakerVerifyExpress.mongo("my_awesome_permission"), success]);
Requires users with valid, in date access tokens with a rate limited scope (suffix _limit_<num>_<timeframe>
)
app.get('/jointrated': [authmakerVerifyExpress.mongoRateLimited("face"), success]);
Requires users with valid, in date access token but if they don't have a rate limited scope it uses face_limit_10_minutes
as a default scope:
app.get('/defaultScope': [authmakerVerifyExpress.mongoRateLimited("face", "face_limit_10_minutes"), success]);
mongoRateLimited: function(tag, defaultScope)
mongoRateLimitedDefault: function(tag, defaultScope)
mongo: function(tag, options)
options.passError (optional) if true passes error via middleware
connectMongo: function(nconf) {
//initialise the db
authmakerVerify.connectMongo(nconf);
}
If you ever need to access the authmaker-verify object that is powering authmaker-verify-express to access any lower level apis you can access it directly like this:
var authmakerVerifyExpress = require('authmaker-verify-express');
authmakerVerifyExpress.authmakerVerify;
FAQs
Express middlewares for authmaker-verify
We found that authmaker-verify-express demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.