Skip to content

Conversation

@benjamin-747
Copy link
Collaborator

No description provided.

@benjamin-747 benjamin-747 requested a review from genedna November 4, 2025 03:44
@genedna genedna requested review from Copilot and removed request for genedna November 4, 2025 03:46
Copy link
Contributor

Copilot AI left a 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 Authorization header
  • Integrates UserStorage into CampsiteApiStore for token-based user lookup
  • Removes the created_at field from LoginUser and 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

Comment on lines 89 to 98
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)
}
Copy link

Copilot AI Nov 4, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a 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.

@benjamin-747 benjamin-747 added this pull request to the merge queue Nov 4, 2025
Merged via the queue into web3infra-foundation:main with commit 1103bb1 Nov 4, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants