Skip to content

jeremythings/express-passport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node Express and Passport test bed

Local Authentication

I have used this to test various configurations for using the Passport module for local authentication of Usernane and Password.

I am not a Node expert, hence why I created this test bed to try to understand how it works better, hopefully it will be of use to others.

I generally run a browser and a shell session side by side so that I can see the output from node at the same time as I use the app.

I have put loads of console.log lines in, its ip to you to add or remove these and implement a properlogging module is you want.

It Allows for:

  • Testing HTTP and HTTPS (see below about certificates)
  • Login of existing users
  • Logout
  • Registration of new users
    • currently set to not automatically log new users in

Running

To install and run, download this to a folder of your choice then run:

npm install
cd certs
bash createkeys.sh
cd ..
npm start

You can then browse using http or https on the ports set (defailt 3000 and 3443).

Note that within the application you can switch between http and https using the buttons provided.

Users

There are some default users and password set, checkout the my-modules/db.js. You can of course register your own users.

Certificates

You need to add some keys into the certs folder, it currently expects the files cert.pem and keys.pem. There is a createkeys.sh script to generate self signed certificates.

Database

In this example I store uid, username and passord in a Javascript object that allows me to look up by name and also by uid.

The data is not persisted so is lost as soon as you stop the app, and is recreated from scratch when you run the app again.

About

Node Express Passport Example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages