@nikositech/auth-redis-handler-nt
v1.0.2
Published
Authorization library with API Token verification and JWT verification using Redis token storage.
Downloads
2
Readme
AuthRedisHandler
Module for authorization verification.
Installation
$ npm install auth-redis-handler-nt --save
## Documentation
configure(obj) Set configuration object before using other functions.
It also set the client of Redis. Example :
{ "JWT_TOKEN": "TESTJWT", "API_KEY": "SUPERAPIKEY" }
checkAPIKey(req, res, next) Middleware for API KEY checking. Returns error with status 401 if wrong API KEY.
checkJWT(req, res, next) Middleware for JWT checking. Returns error with status 401 if wrong JWT.
createJWT_HMAC(exp, data) Return JWT using HMAC algorithm.
createSession(UserID, JWT Set session in Redis.
verifySession(UserID, JWT) Verify if UserID as JWT and is the same.
deleteSession(UserID) Delete JWT (session) of the UserID in Redis.