taebow / fastapi-simple-login

A fastapi simple user and login manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

travis-ci-build-status

fastapi-simple-login

A fastapi simple user and login manager.

Requirements

Dependencies

  • FastAPI
  • Sqlalchemy
  • psycopg2
  • uvicorn
  • pytest

Only tested on Linux (Arch).

Usage

Install dependencies :

make install

Start the development database :

make start-db

Build and run a docker image db.dockerfile that starts a Postgresql server on port 5432.

Run the service endpoint :

make serve

Run the server at http://localhost:8080

Interactive documentation

Default root user

Run the tests

make test

⚠️ This will wipe the database content.

Endpoints

User management

  • GET /users
  • POST /users
  • GET /users/<email>
  • PUT /users/<email>
  • DELETE /users/<email>

Self user

  • GET /users/me
  • PUT /users/me
  • DELETE /users/me

Login

  • POST /login

Testing endpoints

  • GET /resource/public
  • GET /resource/protected

Authorization header

  • Authorization: Bearer "token returned by /login"

Additional implementation details

Use Postgresql pgcrypto and uuid-oss extensions for password hashes and uuid columns.

  • Password hashes are managed / checked in database.
  • Primary keys are generated using uuid-oss extension.

About

A fastapi simple user and login manager

License:MIT License


Languages

Language:Python 96.3%Language:Makefile 2.6%Language:Dockerfile 1.1%