Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

MGDSoft/sails_angular_auth_jsonwebtoken

Repository files navigation

sails_angular_auth_jwt

Build Status

Testing jwt, angular and sails. Htmls and some js angular has been taken from https://github.com/fnakstad/angular-client-side-auth (Frederik Nakstad).

JsonWebToken server side: A salt is generated (password) automatically per user. Then the salt is used to create the encrypted password (as regular...). Also with the salt + Date a user-token is generated and stored Date in the DB. By being unique per user, with this we want each time the user logs in the token is refreshed. To remember the user, a cookie is created with an unique ID (it's only possible to remember the user in one place). The client has a N of tries to authenticate, if he fails them the account will be frozen.

Client-side : It's based in the LocalStore.user and LocalStore.token received from the server when the user authenticates. Through js angular and his interceptor method, if it contains a LocalStore.token valor it will be sended as header authorization (config.headers.Authorization = localStorage.token) on each request.

PD: Use Polyfill because not all the browsers support LocalStorage.

Version live http://sails-angular-jwt.herokuapp.com/

Start the project locally

$ git clone https://github.com/MGDSoft/sails_angular_client_side_auth_jwt.git
$ cd sails_angular_client_side_auth_jwt
$ cp config/local.example.js config/local.js
$ npm install && node app

Test server side

$ npm test

Libs used

Server Side

Client Side

Testing

  • Karma
  • Protractor
  • Jasmine pending

Todo

  • Change http petitions to sockets petitions
  • testing client side

All pull request are welcome !!

About

Sails + Angular + JWT, discontinued

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published