npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

acl-certauth

v1.0.0

Published

A simple client certificate wrapper to the node_acl module

Downloads

3

Readme

#NODE ACL-CertAuth - Simple Client Certificate Wrapper for Node_ACL

A simple wrapper to the node_acl module for implementing client certificate authentication

Please see: https://github.com/OptimalBits/node_acl/

This is a very, very simple approach and you would most likely be better served with PassportJS with an appropriate certificate strategy, a fully flegded logger and far more complex error handling; this is for rough and ready development purposes only.

Evolution may come in time.

##Features

  • Client certificate authentication parsing (Client Cert CN-to-req.session.userId)
  • SimpleLogger
  • ErrorHandler

##Installation

Using npm:

npm install acl-certauth

##Example


const EXPRESS_PORT = 3000;

// CORE MODULES
var https       = require('https');
var app         = require('express')();
var fs          = require('fs');
var acl         = require('acl');
var aclCertAuth = require('acl-certauth');

acl = new acl(new acl.memoryBackend(),aclCertAuth.simpleLogger);
acl.allow('allRoles','/','get');
acl.allow('admins',['/adminapi','/adminapi/'],'get');
acl.allow('users' ,['/userapi','/userapi/']  ,'get');

acl.addUserRoles('user1','admins');
acl.addUserRoles('user2','users');

acl.addRoleParents('admins','allRoles');
acl.addRoleParents('users','allRoles');

// MIDDLEWARE
app.use(aclCertAuth.authenticate);
app.use(acl.middleware());
app.use(aclCertAuth.errorHandler);

// ROUTES
app.get('/', 			index);
app.get('/adminapi', 	adminapi);
app.get('/userapi', 	userapi);

// ROUTEHANDLERS (kept here for testing)
function index (req, res){
    res.send('User: ' + req.session.userId);
}

function adminapi (req, res){
    res.send('admin service');
}

function userapi (req, res){
    res.send('user service');
}

// WEB SERVER START
var httpsConfig = {
  host: 				"your_hostname_must_match_server_cert", 
  pfx:                fs.readFileSync(__dirname + '/config/certs/server_cert_and_key.pfx'),
  ca: 				[ fs.readFileSync(__dirname + '/config/certs/issuing_ca.cert') ],
  requestCert:        true,
  rejectUnauthorized: true
}

https.createServer(httpsConfig, app).listen(EXPRESS_PORT);

Future work

  • AD/LDAP integration

##License CC-BY-SA