TokenFlow optimizes token generation and directory management across multiple tenants using Azure device flow. This repository empowers applications to capture user tokens seamlessly and utilize them for creating app registrations, users, and groups within accessible directories. Unlock the potential of multi-tenant applications with TokenFlow.
This is a straightforward setup for managing Azure resources using containerized applications and Blob Storage, coupled with an automated user login process via Azure Device Code.
Setup Overview
- Azure Container App: Acts as the host for TokenFlow Api Docker image.
- Azure Blob Storage: Manages state data related to Azure Command Line Interface (CLI) operations.
Login Flow
- Prompt user authentication using Azure Device Code.
- Upon successful login, retrieve access token for resource management from the provided endpoint.
Please send email if you consider to hire me.
If you like or are using this project to learn or start your solution, please give it a star. Thanks!
To run the application locally, follow these steps:
-
Create a virtual environment:
python -m venv .venv
-
Activate the virtual environment:
source .venv/bin/activate
-
Install the dependencies management tool:
pip install pip-tools
-
Compile the requirements:
pip-compile requirements.in pip-compile requirements.dev.in
-
Install the dependencies:
pip install -r requirements.txt pip install -r requirements.dev.txt
-
Run the application:
#only on WSL export X_AUTH_TOKEN=169ddeb1-502a-42cf-a222-9dbb8ec2cbf6 uvicorn src.api:app --reload --port 6700
To deploy the application using Docker, use the following steps:
-
Pull the Docker container:
docker pull kdcllc/tokenflow
-
Run the Docker container:
docker run -e LOGGING_LEVEL=INFO -e X_AUTH_TOKEN=<your_auth_token> -p 6700:6700 kdcllc/tokenflow
pytest tests/test_main.py
pytest tests/test_authenticator.py
# runs all tests
python -m pytest
Swagger documentation is available at http://localhost:6700/docs.
LOGGING_LEVEL
: Sets the logging level (default isINFO
).X_AUTH_TOKEN
: Your authentication token for accessing the application.