Authentication and Authorization microservice for crowsnest
Designed to work with:
See docker-compose.dev.yml
Requires:
- python >= 3.8
- docker and docker-compose
- vscode
- Nodejs >= 14.0
- Install the python requirements in a virtual environment:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt -r requirements_dev.txt
# with Conda
conda create -n cn-auth python=3.8
conda activate cn-auth
pip install -r requirements.txt -r requirements_dev.txt
- Install the frontend dependencies:
npm install frontend
-
In different terminal windows:
a. Start Traefik in its development configuration:
docker-compose -f docker-compose.dev.yml up
b. Start the python API by pressing
F5
in vscode, or:export $(xargs < .env) uvicorn backend.main:app --reload --port 8000
c. Start the React development server:
cd frontend npm start
The API's documentation is available at http://localhost/auth/api/docs
black backend tests
pylint backend
pytest tests/
Note: Running the testsuite will fail if you have the development docker-compose stack still running.
The following environmental variables are necessary:
ACCESS_COOKIE_DOMAIN
(e.g. 'www.foo.com')USER_DATABASE_URL
JWT_TOKEN_SECRET
Optional environmental variables:
ACCESS_COOKIE_SECURE
ACCESS_COOKIE_HTTPONLY
ACCESS_COOKIE_SECURE
ACCESS_COOKIE_HTTPONLY
ACCESS_COOKIE_SAMESITE
ACCESS_TOKEN_EXPIRE_MINUTES
ADMIN_USER_USERNAME
ADMIN_USER_PASSWORD
BASE_URL