Skip to content

Example Security Data

Apaichon Punopas edited this page Mar 18, 2018 · 1 revision

Welcome to the node_enterprise wiki!

Prepare security data

  • Add the api exception data in MongoDB following. db.exceptionApi.insert( { "application": "E-Commerce", "module": "security", "className": "Authentication", "method":"LogIn" } )

    db.exceptionApi.insert( { "application": "E-Commerce", "module": "membership", "className": "Members", "method":"Add" } )

Keep logon session in userLogon collection and enable Timelive index features.

db.userLogon.createIndex( { "logOn": 1 }, { expireAfterSeconds: 120 } )

Create user for authention to use api.

The password use bcrypt library. Look at how to assign password, the example in comment code of lab4-4 .(index.js) db.users.insert({ "username": "apaichon@hotmail.com", "password": "a0$f.2GR0ApNPDeaoq3C.KLkupzZKYXTREBhPFp1DF9RAR5SaPEbfYdK" })

Create permission to allow user to use api.

db.authorization.insert({ "username" : "apaichon@gmail.com", "application" : "E-Commerce", "module" : "membership", "className" : "Members", "method" : "Edit" })