Add support for bearer token authentication#117
Merged
Conversation
Adds an optional `token` keyword to the service client. When set, every request (unary and streaming) carries an `authorization: Bearer <token>` header; when left as `nothing` no header is sent, so existing behaviour is unchanged. The token field is threaded through the generated `*_Client` constructors, gRPCServiceClient, and the request builder. The Go test server gains a unary interceptor that validates the header, and a new "Bearer Authentication" testset asserts that the correct token is accepted, a wrong token is rejected with UNAUTHENTICATED, and the default (no-token) client is unaffected. Closes JuliaIO#56
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #117 +/- ##
==========================================
+ Coverage 90.59% 90.65% +0.06%
==========================================
Files 7 7
Lines 542 546 +4
==========================================
+ Hits 491 495 +4
Misses 51 51 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
csvance
approved these changes
Jun 6, 2026
Collaborator
|
Looks good, thanks for the PR! |
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.
Closes #56. Adds an optional
tokenkeyword to the service client; when set, every request (unary and streaming) sends anauthorization: Bearer <token>header, and when left asnothingno header is sent so existing behavior is unchanged. The token threads through the generated*_Clientconstructors,gRPCServiceClient, and the request builder, matching how the existingdeadline/keepaliveoptions flow.The Go test server gains a unary interceptor and a new
Bearer Authenticationtestset asserting the correct token is accepted, a wrong token is rejected withUNAUTHENTICATED, and the default no-token client is unaffected.Note:
test/gen/test/test_pb.jlis a generated artifact — the 8tokenlines were inserted by hand in formatter style to avoid whitespace churn;src/ProtoBuf.jlis the source of truth and is covered by the Code Generation testset.