Skip to content

refactor(examples): bump sdk-go to v0.9.0 and rename Tenant to Domain#20

Merged
appleboy merged 5 commits intomainfrom
bump-sdk-go-v0.9.0
May 1, 2026
Merged

refactor(examples): bump sdk-go to v0.9.0 and rename Tenant to Domain#20
appleboy merged 5 commits intomainfrom
bump-sdk-go-v0.9.0

Conversation

@appleboy
Copy link
Copy Markdown
Member

@appleboy appleboy commented May 1, 2026

Summary

Adopt sdk-go v0.9.0 in go-jwks/ and go-jwks-multi/, mirroring the breaking rename in go-authgate/sdk-go#25: the partition concept formerly called Tenant is now Domain, and the new optional Tenant field is reserved for an in-Domain sub-room (unused by these examples).

  • go-jwks-multi: rename SetIssuerTenantsSetIssuerDomains, IssuerTenantsIssuerDomains, AccessRule.TenantsAccessRule.Domains, Claims.TenantClaims.Domain, JSON response key tenantdomain. Env var ISSUER_TENANTSISSUER_DOMAINS. testissuer mints the domain claim and accepts ?domain= query param. Comments, README, and .env.example reworded to the new vocabulary.
  • go-jwks: no SDK API surface used the rename. The intermediate v0.8.0 of sdk-go pulled appleboy/go-httpretry@v0.12.0 (which requires Go 1.25.9) and forced a go directive bump while migrating, but go mod tidy against v0.9.0 prunes that transitive dep, so the final state stays on go 1.25.8 for consistency with the rest of the repo.
  • /api/admin example: added to go-jwks/main.go to demonstrate the previously-unshown AccessRule fields (Domains, ServiceAccounts, Projects); README updated with the endpoint table, curl example, response sample, and a note on AND-combined fail-closed semantics.

AI Authorship

  • AI was used. Tool: Claude Code (Opus 4.7).
  • AI authored: every change in this PR (code, README rewrites, .env.example, testissuer updates).
  • Human review: spot-checked. The diff is dominated by mechanical rename + doc rewrites; the small amount of net-new logic is the /api/admin route + handler in go-jwks/main.go.

Change classification

  • Leaf — these are reference examples users fork and adapt; no shared library code or core auth path is touched.

Verification

  • go build ./... clean in both go-jwks/ and go-jwks-multi/.
  • go vet ./... clean in both.
  • Grep for tenant across both example dirs (excluding .env, go.sum) returns zero matches — no stale references.
  • Manual: ran go run ./testissuer + the resource server locally, minted a token with ?domain=oa&sa=sync-bot@oa.local&project=admin-tools&scope=email+profile, and confirmed /api/profile, /api/data, /api/admin all return 200; cross-domain (?domain=swrd from auth-a) returns 401 with the expected domain="swrd" allowed=[oa hwrd] server log line.

Migration impact (for users following these examples)

  • ISSUER_TENANTS env var → ISSUER_DOMAINS — local .env files need updating.
  • JSON response keys: tenantdomain on the multi example's /api/profile and /api/data responses.
  • testissuer query param: ?tenant=?domain=; emitted JWT claim is now domain (not tenant).
  • go.mod: stays on go 1.25.8 — same minimum as the other example modules in this repo.

Test plan

  • cd go-jwks && GOTOOLCHAIN=auto go build ./... && GOTOOLCHAIN=auto go vet ./...
  • cd go-jwks-multi && GOTOOLCHAIN=auto go build ./... && GOTOOLCHAIN=auto go vet ./...
  • Run go-jwks-multi/testissuer + resource server, mint token with ?domain=oa&..., confirm 200 on the three protected routes.
  • Cross-domain scenario: mint token from auth-a with ?domain=swrd, confirm 401 with issuer not permitted for this domain server log.

🤖 Generated with Claude Code

- Bump go-jwks and go-jwks-multi to sdk-go v0.9.0 with Go 1.25.9 toolchain
- Rename Tenant to Domain across go-jwks-multi main.go, claims, env vars, and docs per sdk-go #25
- Rename ISSUER_TENANTS environment variable to ISSUER_DOMAINS
- Update testissuer to emit the domain claim and accept ?domain= query parameter
- Add /api/admin endpoint to go-jwks demonstrating Domains, ServiceAccounts, and Projects allowlists

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Go JWKS-based resource-server examples to sdk-go v0.9.0 and migrates the “Tenant” partition concept to the new “Domain” terminology, including docs and the local multi-issuer test token minting tool.

Changes:

  • Bump github.com/go-authgate/sdk-go to v0.9.0 in go-jwks/ and go-jwks-multi/ (and update Go go.mod directives accordingly).
  • Rename multi-issuer example configuration and claims vocabulary from tenantdomain (ISSUER_DOMAINS, domain claim, allowlists).
  • Add /api/admin route to go-jwks to demonstrate jwksauth.AccessRule allowlists beyond scopes, and expand README endpoint/rule documentation.

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
go-jwks/main.go Adds /api/admin route protected by jwksauth.AccessRule and includes domain in profile response.
go-jwks/go.mod Bumps Go directive and sdk-go dependency version.
go-jwks/go.sum Updates sdk-go checksums for v0.9.0.
go-jwks/README.md Documents /api/admin and clarifies allowlist semantics and updated scope-check API.
go-jwks-multi/main.go Renames tenant→domain concepts across env/config, routing allowlists, and JSON responses.
go-jwks-multi/go.mod Bumps Go directive and sdk-go dependency version.
go-jwks-multi/go.sum Updates sdk-go checksums for v0.9.0.
go-jwks-multi/README.md Updates docs from tenant→domain and environment variable names.
go-jwks-multi/.env.example Renames ISSUER_TENANTSISSUER_DOMAINS and updates explanatory comments.
go-jwks-multi/testissuer/main.go Updates minted claim/query param from tenantdomain and updates printed env block.
go-jwks-multi/testissuer/README.md Updates all usage/scenarios from tenant→domain.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go-jwks-multi/README.md Outdated
Comment thread go-jwks-multi/README.md Outdated
Comment thread go-jwks/go.mod Outdated
Comment thread go-jwks-multi/go.mod Outdated
appleboy and others added 2 commits May 1, 2026 19:03
… doc comment

- Add domain to /api/admin response for parity with go-jwks and the README claim
- Reword top doc comment so it does not imply every handler enforces every claim allowlist

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Revert go directive to 1.25.8 in go-jwks and go-jwks-multi for consistency with the rest of the repo (go-httpretry was pruned by tidy and 1.25.9 is no longer required)
- Replace stale accessRule and v.middleware references in go-jwks-multi README with the actual jwksauth.AccessRule and jwksauth.Middleware symbols
- Capitalize Domains struct field in the fail-closed bullet to match exported Go field naming

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go-jwks/main.go Outdated
Comment thread go-jwks/go.mod
Allowlist (Domain/ServiceAccount/Project) rejects produce a generic 401, but scope failures produce 403 insufficient_scope with details — call this out in the AccessRule comment so it does not read as if every reject is a 401.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go-jwks/README.md
The handler started returning the domain claim, but the README sample still omitted it. Mirror the actual handler shape and note that the field is empty when AuthGate does not emit a domain claim.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@appleboy appleboy merged commit 3bf10a0 into main May 1, 2026
8 checks passed
@appleboy appleboy deleted the bump-sdk-go-v0.9.0 branch May 1, 2026 11:54
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