Skip to content

Kibo/Pimp

Repository files navigation

Pimp

Lightweight authentication server based on JSON Web Token. It contains users management, tokens management, logging.

Support

Buy Me A Coffee

Version

  • 1.1.0

Workers

  • Node (currently: v12.18.2)
  • Express 4
  • MongoDB
  • Passport
  • Google ReCaptcha v3
  • I18n

Tools

  • NPM - Node.js package manager.
  • Grunt - The JavaScript Task Runner.

Before install

  • pls, see config.js. Especially the database section.

Install

	$ git clone https://github.com/Kibo/Pimp.git
	$ cd Pimp
	$ npm install 
	$ npm start

First login

Note:

  • Delete init path after first login. It creates admin.
  • Don't delete local token. You couldn't sign in.

Tests

	$ npm test 

Docker

pimp in Docker hub

Env-variable

Env-variable Description
HOST_NAME The hostname, if not provided the default localhost will be used
DB_USERNAME The username for the database connection, if not provided it does not use authentication.
DB_PASSWORD The password for the database user
DB_HOST The host IP address or DNS name without the port! If not provided the default localhost will be used
DB_PORT The port of the mongoDB database, if not provided the default 27017 will be used
DB_NAME The name of the database, if not provided the default pimp will be used

Endpoints

POST /api/v1/login

REQUEST:{
	Header:{
		Content-Type:application/json
		Accept:application/json
	},
	Body:{
		"email": "[email protected]"
		"password": "password"
		"iss":"www.klient-app.com"
	}
}

RESPONSE:{
	status:200,
	header:{
		Content-Type:application/json
	},
	body:{		
		accessToken:"1234.4567.78910"
	}
}

POST /api/v1/refresh

REQUEST:{
	Header:{
		Content-Type:application/json
		Accept:application/json
		Authorization:Bearer [JWT_TOKEN]
	},
	Body:{}
}

RESPONSE:{
	status:200,
	header:{
		Content-Type:application/json
	},
	body:{		
		accessToken:"xxxxxxx.yyyyyyyy.zzzzzzzzz"
	}
}

Token

{
	header:{
		"alg": "HS256",
		"typ": "JWT"
	},
	payload:{
		iat:"token creation time",
		iss:"domain name",
		exp:"time until is valid",
		user:{			
			firstname:"John",
			lastname:"Deen"
			email:"[email protected]",
			roles:["role1", "role2"],
			isActive:Boolean,
			isNotification:Boolean,			
		}
    },
    signature:"zzzzzzzzz"
}

TODO

  • Google ReCaptcha v3 to login, reset, signup forms
  • I18n

About

Lightweight authentication server based on JSON Web Token.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages