Skip to content

Node Security Application which will bootstrap a node js application in seconds and ready with a login features.

Notifications You must be signed in to change notification settings

sanketmaru/node-security

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-security

Node Security Application which will authorize as well as authenticate users.

Currently the configurations are done with mysql db , next version will include configurations with NoSql database as well and a ready login module which will provide authorization for users. The code is also tightly coupled with the configs used. In the next versions users should not be concern with app.js changes and just need to place the configurations.

Below steps needs to be done to use this module :-

  1. Create a config directory inside your application folder.
  2. Copy sampledb.js and sampleconfig.js and rename it with db.js and config.js and place your configurations in this file. This include db configurations only.
  3. In your app.js place the below code to use the SignIn and SignUp features.

Main app.js sample format

var express = require('express'); var DBConfig = require('./config/db'); var rolesConfig = require('./config/roles'); GLOBAL.DBConfig = DBConfig; GLOBAL.rolesConfig = rolesConfig; newMod = require('./lib'); var app = express();

app.use(express.cookieParser()); app.use(express.session({secret: 'xyz'}));

app.get('/login', newMod.signIn, function(req, res){ res.jsonp({ success:true, "message" : "Login Success" }) });

app.get('/signUp', newMod.signUp, function(req, res){ res.jsonp({ success:true, "message" : "signUp Success" }) });

app.get('/addUserRole', newMod.addUserRole, function(req, res){ res.jsonp({ success:true, "message" : "addUserRole Success" }) });

app.get('/admin', newMod.checkUserRole, newMod.checkUrlPattern, function(req, res){ res.jsonp({ success:true, "message" : "admin role Success" }) });

app.get('/user', newMod.checkUserRole, newMod.checkUrlPattern, function(req, res){ res.jsonp({ success:true, "message" : "admin role Success" }) });

app.listen(process.env.PORT || 9001);

About

Node Security Application which will bootstrap a node js application in seconds and ready with a login features.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •