Skip to content

feat: JWT auth, minimal ClickHouse Cloud CI #215

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

feat: JWT auth, minimal ClickHouse Cloud CI #215

wants to merge 6 commits into from

Conversation

slvrtrn
Copy link
Contributor

@slvrtrn slvrtrn commented Apr 23, 2025

Summary

JWT auth is a new ClickHouse Cloud feature, introduced in January 2025.

  • Added Client::with_access_token, slightly reworking the internal auth implementation.
  • Client::with_user and Client::with_password will panic if called after Client::with_access_token (and vice versa).
  • insert and query will use appropriate headers based on the authentication method.
  • Added a minimal ClickHouse Cloud setup for CI JWT tests in GHA

Closes #183

Checklist

  • Unit tests
  • Integration tests
  • A human-readable description of the changes was provided so that we can include it in CHANGELOG later

@slvrtrn slvrtrn changed the title feat: JWT auth feat: JWT auth, minimal ClickHouse Cloud CI Apr 23, 2025
@slvrtrn slvrtrn requested a review from Copilot April 23, 2025 18:31
Copy link

@Copilot 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 introduces JWT authentication via a new method on Client along with enhanced integration tests for ClickHouse Cloud and related CI configuration updates.

  • Adds Client::with_access_token and updates authentication handling (credentials vs. JWT)
  • Implements integration tests for JWT authentication and adjusts database creation to include a timestamp
  • Refactors header handling and query/insert authentication while updating CI workflows and changelog

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/it/main.rs Adds integration test documentation and environment-specific helpers
tests/it/cloud_jwt.rs Introduces JWT-specific integration tests
src/watch.rs Updates documentation for the fetch method in Watch
src/query.rs Refactors query header injection by delegating to with_authentication
src/lib.rs Implements Authentication enum and updates Client methods accordingly
src/insert.rs Uses with_authentication for header injection in insert operations
src/headers.rs Adds with_authentication helper for building request headers
CHANGELOG.md Documents the new JWT authentication feature
.github/workflows/ci.yml Revises CI configuration for supporting ClickHouse Cloud integration tests

@slvrtrn slvrtrn requested review from serprex, loyd and mshustov April 23, 2025 18:33
@slvrtrn slvrtrn marked this pull request as ready for review April 23, 2025 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support JWT auth
1 participant