Skip to content

feat: add bearer token connections - #30

Merged
shreyanshjain7174 merged 1 commit into
mainfrom
feat/bearer-token-connections
Aug 30, 2026
Merged

shreyanshjain7174 merged 1 commit into
mainfrom
feat/bearer-token-connections

Conversation

@shreyanshjain7174

Copy link
Copy Markdown
Contributor

What changed:

  • Adds POST /admin/tokens for connecting a bearer token to an existing user and registered bearer service.
  • Restricts the endpoint to configured bearer services, so OAuth services retain their authorization-code flow.
  • Stores tokens using the existing AES-GCM encrypted vault and returns 204 with no token body.
  • Wires the endpoint into the production command and documents it for Slack, Stripe, and Calendly.

Verification:

  • go test ./tests/integration -run TestIntegration_AdminConnectBearerToken -count=1 -v
  • go test ./... -race -count=1
  • go vet ./...
  • semgrep scan --config p/default internal/admin/handler.go cmd/agentgw/main.go tests/integration/gateway_test.go
  • git diff --check

All passed locally. Semgrep reported 0 findings.

Signed-off-by: Shreyansh Sancheti <43677304+shreyanshjain7174@users.noreply.github.com>
@shreyanshjain7174
shreyanshjain7174 requested a lite review from Copilot August 30, 2026 03:44
@shreyanshjain7174
shreyanshjain7174 merged commit 529e912 into main Aug 30, 2026
2 checks passed
@shreyanshjain7174
shreyanshjain7174 deleted the feat/bearer-token-connections branch August 30, 2026 03:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an admin endpoint to connect bearer tokens to existing users for configured bearer services. This fits the gateway model where the vault stores credentials and the proxy injects them upstream.

Changes:

  • Add POST /admin/tokens admin endpoint to store bearer tokens in the existing encrypted vault.
  • Gate the endpoint to services configured with auth.type: bearer.
  • Add integration tests and README docs for the new endpoint. Wire the route in cmd/agentgw.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/integration/gateway_test.go Adds integration coverage for connecting a bearer token and dispatching an action using it.
README.md Documents POST /admin/tokens behavior and request shape.
internal/admin/handler.go Implements ConnectBearerToken and plumbs Registry into the admin handler.
cmd/agentgw/main.go Wires the new admin route into the production server.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/admin/handler.go
Comment on lines +152 to +154
req.UserID = strings.TrimSpace(req.UserID)
req.Service = strings.TrimSpace(req.Service)
if req.UserID == "" || req.Service == "" || strings.TrimSpace(req.AccessToken) == "" {
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.

2 participants