Microservice managing everything related to user authentication for JrC. Implemented as an API served over HTTP(S).
The API is implemented using django-restframework with Redis as a key/value-store.
git clone [email protected]:juniorconsulting/jrc-auth.gitcd jrc-auth && virtualenv env && source env/bin/activate && sudo pip install -r requirements.txtcp jrc_auth/settings/example_local.py jrc_auth/settings/local.py- Update
local.py. If postgres run:psqlCREATE DATABASE mydbCREATE USER myuser WITH PASSWORD 'password';GRANT ALL PRIVILEGES ON DATABASE mydb TO myuser;\q
python manage.py migratepython manage.py createsuperuser- Install Redis
redis-serverpython manage.py runserver
jrc-auth is running on the jrc-services droplet.
It is controlled using supervisor and is running under the jrcauth user.
For now, deployment is not automated, so the procedure is as follows:
- SSH to
jrc-services. sudo su - jrcauth- Pull new changes, migrate and install/update dependencies as necessary.
Returns a list of all users if authenticated as superuser, only yourself if otherwise.
Registers a new user.
Payload
{
'username': '<username_here>',
'email': '<JrC_email_here>'
}
Returns a token if username/password was valid, error message otherwise.
Payload
{
'username': '<username_here>',
'password': '<password_here>'
}
Validates a token, returns userid on success, error message on failure.
Payload
{
'token': '<token_here>'
}
Logs out the user.
Payload
{
'token': '<token_here>'
}