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 upb. Start the python API by pressing
F5in 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 backendpytest 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_URLJWT_TOKEN_SECRET
Optional environmental variables:
ACCESS_COOKIE_SECUREACCESS_COOKIE_HTTPONLYACCESS_COOKIE_SECUREACCESS_COOKIE_HTTPONLYACCESS_COOKIE_SAMESITEACCESS_TOKEN_EXPIRE_MINUTESADMIN_USER_USERNAMEADMIN_USER_PASSWORDBASE_URL