Add firestore token service #16
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new Firebase Token Generation Service designed to run on Google Cloud Run. The service enables secure generation of Firebase custom tokens for workspace service accounts, facilitating controlled access to Firestore. The implementation includes the service code, a Dockerfile for containerization, dependency management, deployment automation, and best practices for security and maintainability.
The most important changes are:
Service Implementation and Security:
main.pyimplementing a Flask-based web service that authenticates requests from workspace service accounts, verifies participant existence in Firestore, and generates Firebase custom tokens with proper claims. Includes/healthand/generate-tokenendpoints, robust logging, and error handling.Containerization and Deployment:
Dockerfilethat uses a non-root user, installs dependencies, and runs the service with Gunicorn for production readiness..dockerignorefile to exclude unnecessary files from the container build context, improving build performance and security.deploy_token_service.sh) to automate building, deploying, and configuring the service on Cloud Run, including IAM permissions and environment setup.Dependency Management:
requirements.txtspecifying all Python dependencies with pinned versions for reproducible builds.