-
Notifications
You must be signed in to change notification settings - Fork 47
WithTransportCredentials #568
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
base: main
Are you sure you want to change the base?
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 injecting custom gRPC transport credentials to enable connections with certificates issued by custom certificate authorities. Previously, only the system certificate pool or insecure skip verify were supported as transport options.
Changes:
- Added
WithTransportCredentialsoption to bothpkg/client/zitadelandpkg/clientpackages - Modified transport option logic to prioritize custom credentials over default options
- Added example implementations demonstrating custom CA usage with both admin and management APIs
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/client/zitadel/client.go | Added transportCredentials field to Connection struct and WithTransportCredentials option function; modified transportOption to check for custom credentials first |
| pkg/client/client.go | Added transportCredentials field to clientOptions, WithTransportCredentials option function, and modified newConnection to accept and use custom credentials |
| example/customCA/middleware/tokenTools.go | Helper functions for creating JWT profile token sources with custom HTTP clients for CA trust |
| example/customCA/admin/admin.go | Example demonstrating admin API usage with custom CA certificate |
| example/customCA/Management/management.go | Example demonstrating management API usage with custom CA certificate |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ctx := context.Background() | ||
|
|
||
| //build tls config with custom CA | ||
| var tlsConfig = &tls.Config{} |
Copilot
AI
Jan 16, 2026
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 tls.Config is initialized with default values, which may not enforce minimum TLS version requirements. For production use, consider explicitly setting MinVersion (e.g., tls.VersionTLS12 or tls.VersionTLS13) to ensure secure TLS connections. While this is example code, it sets a pattern that users might follow.
| var tlsConfig = &tls.Config{} | |
| var tlsConfig = &tls.Config{ | |
| MinVersion: tls.VersionTLS12, | |
| } |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pr adds an option to inject custom grpc transport credentials into the connection. The primary reason for this is to provide a way to trust certificates that were issued by a custom ca. The current implementation allowed for the SystemCertPool or insecureSkipVerify as the only transport options.
Definition of Ready