Skip to content

Add support for bearer token authentication#117

Merged
csvance merged 1 commit into
JuliaIO:mainfrom
JohnCobbler:feat/56-bearer-auth
Jun 6, 2026
Merged

Add support for bearer token authentication#117
csvance merged 1 commit into
JuliaIO:mainfrom
JohnCobbler:feat/56-bearer-auth

Conversation

@JohnCobbler

Copy link
Copy Markdown
Contributor

Closes #56. Adds an optional token keyword to the service client; when set, every request (unary and streaming) sends an authorization: Bearer <token> header, and when left as nothing no header is sent so existing behavior is unchanged. The token threads through the generated *_Client constructors, gRPCServiceClient, and the request builder, matching how the existing deadline/keepalive options flow.

The Go test server gains a unary interceptor and a new Bearer Authentication testset asserting the correct token is accepted, a wrong token is rejected with UNAUTHENTICATED, and the default no-token client is unaffected.

Note: test/gen/test/test_pb.jl is a generated artifact — the 8 token lines were inserted by hand in formatter style to avoid whitespace churn; src/ProtoBuf.jl is the source of truth and is covered by the Code Generation testset.

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-commenter

codecov-commenter commented Jun 5, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.65%. Comparing base (0f62b98) to head (56bd146).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@csvance

csvance commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

Looks good, thanks for the PR!

@csvance csvance merged commit a84e04f into JuliaIO:main Jun 6, 2026
13 checks passed
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.

Bearer Authentication Support

3 participants