Coder Social home page Coder Social logo

harish1611 / authentication-security Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 298 KB

Authentication & Security Repository: It is created to demonstrate and practice different levels of Authentication & Security using NodeJS,EJS,MongoDB.

JavaScript 34.06% CSS 2.92% EJS 63.02%
ejs expressjs js mongoose monogodb nodjs

authentication-security's Introduction

Authentication-Security

Authentication & Security Repo: It is created to describe and practice different levels of Auth & Security.( Go through the Git Commit sequence to understand different levels)

Tools & Technologies

  • NodeJS
  • ExpressJS
  • EJS
  • MongoDB

Level-1: Basic ( Username & Password)

In Level-1 Auth & Security, Username & Password are used for user Authentication process. It is the least secure approach.

mongoDB Level-1 data As we can see, user credentials direclty stored in the DB with out any security.

Level-2: Encryption

In Level-2 Auth & Security, the password is encrypted using mongoose-encryption and stored as the encrypted password in the DB. During login, it is automatically decrypted and the user is authenticated. This method provides better security than Level-1.

mongoDB Level-2 data

Level-3: Hashing with md5

In Level-3 Auth & Security, the password is scrambled using Hash techniques, unlike encryption techniques. Once the password is scrambled, we cannot unscramble it back. Here, it takes the user-entered password during login, hashes it, and compares it with the stored hashed password to authenticate. Practically, this approach is better than Level-2, but it has its own demerits.

mongoDB Level-3 data

Level-4: Hashing & Salting with Bcrypt

In Level-4 Auth & Security, a notable drawback of the Hash function is its tendency to generate the same hashed string for identical passwords. If a user selects a commonly used password, it becomes susceptible to password cracking through rainbow table attacks.

To address this vulnerability, a combination of Hashing & Salting is employed to ensure that each password is distinct from others. Salting, in this context, involves appending a unique value to the input before it undergoes the hashing process. The primary purpose of salting is to fortify the system against rainbow table attacks, a form of pre-computed attack where an adversary matches the hashes of numerous plaintext passwords against the targeted hash they aim to decipher. This integrated approach significantly enhances security, raising it to Level-3.

mongoDB Level-4 data

Level-5: Cookies and Sessions

In Level-5 Auth & Security, the code demonstrates robust security practices and user authentication techniques using Express, Passport, and MongoDB. This approach ensures a high level of security for user accounts and data. The following security measures are implemented:

Environment Variables: Sensitive information, such as the secret key and database URI, is securely stored in environment variables, enhancing the overall security of the application.

Session Management: The use of express-session facilitates the management of user sessions, providing security against session-based attacks and unauthorized access.

Hashing and Salting: By integrating passport-local-mongoose and appropriate hashing techniques, the passwords are securely hashed, rendering them less vulnerable to attacks.

Authentication and Authorization: The code employs Passport for authentication and authorization purposes, ensuring that only authenticated users can access specific routes. Unauthorized access attempts are redirected to the login page.

mongoDB Level-5 data

authentication-security's People

Contributors

harish1611 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.