Skip to content

feat(headwaters-client): send a bearer token over TLS - #97

Merged
roeap merged 1 commit into
feat/caller-authfrom
feat/client-bearer-tls
Dec 5, 2026
Merged

roeap merged 1 commit into
feat/caller-authfrom
feat/client-bearer-tls

Conversation

@roeap

@roeap roeap commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #96.

headwaters-client's default transport takes plaintext URLs only, so with_token / HEADWATERS_TOKEN can't reach an https:// server. A Neon deployment is https, and since #96 it authenticates callers.

  • HeadwatersClient::new_with_token(config, token) (cloud-auth feature) sends Authorization: Bearer <token> over olai-http's TLS client, using CloudClient::new_with_token.
  • HEADWATERS_AUTH=token makes the cloud-auth from_env send HEADWATERS_TOKEN the same way. It is an error if the token is unset.
  • Docs: the crate docs, README, with_token, ENV_TOKEN and ENV_AUTH say which tokens a server with auth.mode = "olai-auth" accepts: a Neon Auth access token minted for one of its audiences, or an olk_ API key. The plaintext path's https error now points at new_with_token.
  • Test: a raw-socket server captures the request and checks the bearer header.

This pull request and its description were written by Isaac.

@codecov

codecov Bot commented Dec 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.38776% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/headwaters-client/src/client.rs 69.38% 14 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

The default transport is plaintext only, so `with_token` / HEADWATERS_TOKEN
could not reach an `https://` server such as headwaters on Neon, which now
authenticates callers (Neon Auth access tokens, `olk_` API keys).

With `cloud-auth`, add `HeadwatersClient::new_with_token` (olai-http's
`CloudClient::new_with_token` over its TLS client) and `HEADWATERS_AUTH=token`
for `from_env`, which sends HEADWATERS_TOKEN. Document which tokens a server
with `auth.mode = "olai-auth"` accepts, and point the plaintext path's https
error at the new constructor.

Co-authored-by: Isaac <no-reply@databricks.com>
@roeap
roeap force-pushed the feat/client-bearer-tls branch from 21c3ab2 to 904631e Compare December 5, 2026 06:43
@roeap
roeap merged commit b3e8f92 into main Dec 5, 2026
2 of 3 checks passed
@roeap
roeap deleted the feat/client-bearer-tls branch December 5, 2026 06:43
@github-actions github-actions Bot mentioned this pull request Dec 5, 2026
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.

1 participant