refactor(examples): bump sdk-go to v0.10.0 for prefixed claims#24
Merged
refactor(examples): bump sdk-go to v0.10.0 for prefixed claims#24
Conversation
- Bump go-authgate/sdk-go from v0.9.0 to v0.10.0 - Wire JWT_PRIVATE_CLAIM_PREFIX env var through go-jwks and go-jwks-multi to jwksauth.WithPrivateClaimPrefix - Update testissuer to mint <prefix>_domain / <prefix>_service_account / <prefix>_project claims (default "extra") and read JWT_PRIVATE_CLAIM_PREFIX - Refresh README and .env.example to document the new prefix model and the removal of Tenant in favor of Claims.Extras Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates the go-jwks/ and go-jwks-multi/ example resource servers to use github.com/go-authgate/sdk-go v0.10.0 and to support the SDK’s new configurable private-claim prefix (JWT_PRIVATE_CLAIM_PREFIX) for reading AuthGate’s server-attested Domain / Project / ServiceAccount claims.
Changes:
- Bump
github.com/go-authgate/sdk-gofromv0.9.0→v0.10.0in both Go example modules. - Thread
JWT_PRIVATE_CLAIM_PREFIXfrom env into the verifier construction viajwksauth.WithPrivateClaimPrefix(...), and log the resolved prefix at startup. - Update
go-jwks-multi/testissuerto mint prefixed claim keys, and refresh READMEs /.env.examplefiles to document the new model.
Reviewed changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| go-jwks/main.go | Wires JWT_PRIVATE_CLAIM_PREFIX into verifier options and logs the effective prefix. |
| go-jwks/go.mod | Bumps sdk-go dependency to v0.10.0. |
| go-jwks/go.sum | Updates checksums for sdk-go v0.10.0. |
| go-jwks/README.md | Documents prefixed server-attested claims and the new env var behavior. |
| go-jwks/.env.example | Adds JWT_PRIVATE_CLAIM_PREFIX with guidance and examples. |
| go-jwks-multi/main.go | Wires JWT_PRIVATE_CLAIM_PREFIX into multi-verifier options and startup logging. |
| go-jwks-multi/go.mod | Bumps sdk-go dependency to v0.10.0. |
| go-jwks-multi/go.sum | Updates checksums for sdk-go v0.10.0. |
| go-jwks-multi/README.md | Updates docs from “custom claim JSON tags” to the new WithPrivateClaimPrefix model and wire-level keys. |
| go-jwks-multi/.env.example | Adds JWT_PRIVATE_CLAIM_PREFIX documentation for the multi-issuer example. |
| go-jwks-multi/testissuer/main.go | Reads JWT_PRIVATE_CLAIM_PREFIX, precomputes prefixed claim keys, and mints tokens with prefixed claims. |
| go-jwks-multi/testissuer/README.md | Documents that /sign mints <prefix>_* keys and warns about prefix mismatch fail-closed behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Call godotenv.Load at testissuer startup, mirroring the pattern in go-jwks-multi/main.go, so a single shared go-jwks-multi/.env can drive JWT_PRIVATE_CLAIM_PREFIX (and any future testissuer env vars) on both ends without exporting them per shell. - Document the .env behaviour in testissuer/README.md. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
appleboy
added a commit
that referenced
this pull request
May 3, 2026
- Upgrade github.com/go-authgate/sdk-go from v0.7.0 to v0.10.0 in go-cli, go-webservice, and go-m2m - No source changes required since these examples do not use the Tenant/Domain or prefixed-claim APIs that drove the v0.9 and v0.10 releases - Aligns the remaining Go examples with go-jwks and go-jwks-multi, which were bumped in #24
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.
Summary
Adopt sdk-go v0.10.0 in
go-jwks/andgo-jwks-multi/, mirroring go-authgate/sdk-go#27: the SDK now reads AuthGate's three server-attested claims (Domain,Project,ServiceAccount) under a configurableJWT_PRIVATE_CLAIM_PREFIX(defaultextra, so wire keys areextra_domain/extra_project/extra_service_account), removes theClaims.Tenantfield in favour of a genericClaims.Extrasmap, and exposesWithPrivateClaimPrefix.JWT_PRIVATE_CLAIM_PREFIXfrom env →jwksauth.WithPrivateClaimPrefix(a single env var that pairs byte-for-byte with the AuthGate server-side knob); resolved prefix is logged on startup. README +.env.exampleupdated to document the new prefix model.go-jwks-multi/testissuer: must-fix — baredomain/service_account/projectkeys are no longer recognized by v0.10.0, so every minted token would fail the resource server'sAccessRule. The fixture now readsJWT_PRIVATE_CLAIM_PREFIX(defaultextra), precomputes the three prefixed claim keys once per issuer, and emits them under that prefix. The/signquery-param surface (?domain=oa&sa=...&project=...) is unchanged — only the JWT internal keys move.go-jwks-multi/README.md: staleextraClaimsGo struct snippet and "namespaced claims" extension-point bullet replaced — the new SDK has no JSON tags onClaims, so the "edit the json tag" customization path is gone; pointed atWithPrivateClaimPrefixinstead.AI Authorship
.env.example,testissuerupdates).JWT_PRIVATE_CLAIM_PREFIXwiring in bothmain.gofiles (each ~3 lines around anOptionslice) plus the precomputeddomainKey/serviceAccountKey/projectKeyfields ontestissuer'sissuerstruct.Change classification
AccessRule) live in the SDK and were exercised end-to-end against this PR.Plan reference
Worktree-local plan at
~/.claude/plans/https-github-com-go-authgate-sdk-go-pull-indexed-wadler.md. Goal: align both examples with the upstreamJWT_PRIVATE_CLAIM_PREFIXrollout so default-prefix tokens decode correctly out of the box, custom-prefix deployments have a knob, and the localtestissuerkeeps mid-cycle development workable.Verification
go build ./... && go vet ./...clean in bothgo-jwks/andgo-jwks-multi/(incl.testissuer).testissuer:?domain=oa&sa=sync-bot@oa.local&project=admin-tools→/api/profilereturns 200 with all three server-attested fields populated.?domain=swrdfrom auth-a (which only ownsoa,hwrd) → 401, server log:issuer not permitted for this domain: domain="swrd".JWT_PRIVATE_CLAIM_PREFIX=acme→ 200, claims populated.acme, resource server default → 401, server log shows emptydomain=""(the documented fail-closed mode fromclaims_prefix_test.go::TestPrefixedClaims_CustomPrefix/default_prefix_no_fallback).go-jwkssingle-issuer —/api/admin200 withdomain/service_account/projectpopulated; startup log confirmsPrivate claim prefix: "extra" (SDK default).Migration impact (for users following these examples)
domainclaims; the new examples won't read them andAccessRule{Domains: ...}will fail closed.JWT_PRIVATE_CLAIM_PREFIX— leave unset for the SDK defaultextra; set it byte-for-byte with the AuthGate server-side value if your deployment overrides the prefix.Claims.TenantandTokenInfo.Tenant()are gone in v0.10.0. Neither example used them; downstream consumers reading the SDK directly needv, _ := info.Extra("tenant"); s, _ := v.(string).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 ./...go-jwks-multi/testissuer+ resource server (default prefix), mint?domain=oa&sa=sync-bot@oa.local&project=admin-tools&scope=email+profile, confirm 200 on/api/profile.?domain=swrd, confirm 401 withissuer not permitted for this domainserver log.JWT_PRIVATE_CLAIM_PREFIX=acme, confirm the same happy-path returns 200; with mismatched values, confirm 401.🤖 Generated with Claude Code