feat: Add JWT authentication to agent API and frontend#3
Draft
google-labs-jules[bot] wants to merge 1 commit intodevfrom
Draft
feat: Add JWT authentication to agent API and frontend#3google-labs-jules[bot] wants to merge 1 commit intodevfrom
google-labs-jules[bot] wants to merge 1 commit intodevfrom
Conversation
This commit introduces JWT-based authentication to the agent application and updates the frontend application to use it.
Key changes:
- A new `/token` endpoint is added to the agent application to issue JWTs based on username/password credentials.
- The `/sessions` and `/sessions/{session_id}/message` endpoints are now protected and require a valid JWT.
- The `frontend/main.py` application is updated to fetch a JWT from the agent and include it in all subsequent API calls.
- Token handling in the frontend is optimized with in-memory caching and a robust retry mechanism for handling token expiration.
- `docker-compose.yml` is updated to provide the necessary API credentials to the frontend service via environment variables.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 change adds JWT authentication to the agent application and updates the frontend to authenticate its requests. The agent API now has a
/tokenendpoint and protected session endpoints. The frontend application fetches a token and uses it for all communication with the agent, with an efficient caching mechanism.