Giter Site home page Giter Site logo

nodesqliteauthapi's Introduction

A very basic 'base' project to test, practice, familiarize and proof-of-concept of a SQLite3/Sequelize/NodeJS/Express RESTful API featuring authentication and authorization.

The model is simple as the two basic Classes, User and Role, which serve, both as example and as Authentication (User) / Authorization (Role) basis.

  • Authentication and authorization are performed as a chain of middleware filtering processes in router.
  • Authentication is based in JWT using jsonwebtoken.
  • Models / Persistence is based on Sequelize.
  • An open login endpoint provides the JWT generation mechanism. User and password credentials are validated against DB. User and Role are stored as part of token.
  • Middleware athentication validates and decodes token getting
  • Middleware authorization compares token role with required Role.
  • Routers do chain-use authentication and authorization middleware.

CONFIG (not for prod... just for test/demo purposes only!):

  • Configuration stored in config.js based in process NODE_ENV env var
  • NODE_ENV set in package.json start script

CREDS (... demo/test purposes!)

  • A pair of roles admin and user are created when initializing DB.
  • An admin role user is created when initializing DB. Username and password are defined in config.js file.

nodesqliteauthapi's People

Contributors

alexolivan avatar

Watchers

James Cloos avatar  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.