-
Notifications
You must be signed in to change notification settings - Fork 105
feat: support token validation for buckal cli #1607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for bearer token authentication alongside existing cookie-based session authentication, and refactors the CampsiteApiStore to accept a UserStorage parameter for token validation. The created_at field is removed from the LoginUser model as it's no longer needed.
- Adds bearer token authentication flow for CLI users via the
Authorizationheader - Integrates
UserStorageintoCampsiteApiStorefor token-based user lookup - Removes the
created_atfield fromLoginUserand related models to simplify the data structure
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| mono/src/api/oauth/campsite_store.rs | Adds user_storage field and load_user_from_token method for bearer token authentication |
| mono/src/api/oauth/mod.rs | Implements bearer token extraction and fallback to cookie-based session authentication |
| mono/src/api/oauth/model.rs | Removes created_at field from LoginUser, CampsiteUserJson, and GitHubUserJson models |
| mono/src/server/http_server.rs | Updates CampsiteApiStore instantiation to pass UserStorage |
| mono/tests/*.rs | Updates test mocks to pass UserStorage::mock() to CampsiteApiStore::new() |
| jupiter/src/storage/user_storage.rs | Adds mock() method and Debug derive for testing support |
| jupiter/src/storage/base_storage.rs | Adds Debug derive to BaseStorage |
| pub async fn load_user_from_token(&self, token: String) -> anyhow::Result<Option<LoginUser>> { | ||
| if let Some(username) = self.user_storage.find_user_by_token(&token).await? { | ||
| let user = LoginUser { | ||
| username, | ||
| email: "".to_string(), | ||
| campsite_user_id: "".to_string(), | ||
| avatar_url: "".to_string(), | ||
| }; | ||
| return Ok(Some(user)); | ||
| } | ||
| Ok(None) | ||
| } |
Copilot
AI
Nov 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function creates a LoginUser with empty strings for email, campsite_user_id, and avatar_url. Consider using a more explicit default pattern like Default::default() for these fields or document why empty strings are appropriate for token-based authentication. This would make the intent clearer and be more maintainable if the struct changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
1103bb1
No description provided.