Repository navigation
Conversation
Adopters who want to embed the auth server need one place to learn what the package covers, how to mount it, and where the architecture docs are. The README describes pkg/authserver as an embeddable Go OAuth 2.0 authorization server, with its supported grants and standards, a quick start, and an overview of its components. Affected components: pkg/authserver (documentation only) Co-authored-by: Mecatl <[email protected]>
rdimitrov
left a comment
There was a problem hiding this comment.
Needs a few fixes before merge: the README is accurate on endpoints, types and links, but the quick-start snippet and a few framing claims would mislead an embedder.
Design: A package-level README next to the code is the right owner for an embedder entry point, and pointing at docs/arch 11/17/18 for depth avoids a second source of truth. The drift risk is in the parts that restate feature status and standards from those pages; keeping those to a short list with links would reduce it.
pkg/authserver/README.md:89-91: the quick start mountsmux.Handle("/.well-known/", srv.Handler()). That prefix captures every well-known path, but the handler only registersjwks.json,oauth-authorization-server[/*]andopenid-configuration[/*](server/handlers/handler.go:511-515); everything else 404s from the auth server's router. A resource server that serves its own/.well-known/oauth-protected-resourceon the same mux (the headline use case) loses it by copying this snippet. Fix: mount the specific paths, or add a comment warning about the prefix.README.md:36-39,:149-151: the README says embedders commonly wrap storage with decorators, but not thatstorage.Storagedeliberately does not embedDCRCredentialStore/DeviceCodeStorage/RememberedConsentStorage.newServerasserts these on the unwrapped base store and fails withstorage backend %T does not implement storage.DCRCredentialStore(server_impl.go:385-387). A decorator withoutUnwrap() Storage, or a from-scratch backend, fails atauthserver.New. Fix: one sentence saying decorators must exposeUnwrap()(seestorage/client_admission.go) and custom backends must implement the optional interfaces.README.md:9-14and the PR body: "no dependency on MCP" is overstated. There are no MCP imports, but behaviour is MCP-shaped:config.go:2438rejects an emptyAllowedAudiences("required for MCP compliance"),server/provider.go:632forces S256 per the MCP spec, and the default client is named "ToolHive MCP Client" (config.go:1624). A non-MCP embedder hits the mandatory audience list immediately. Fix: say there is no MCP code dependency, but defaults/validation follow MCP conventions, and thatAllowedAudiencesis required.README.md:11-14: onlypkg/oauthprotoandpkg/networkingare named as shared dependencies, but non-test code also importspkg/auth/dcr,pkg/storageerr,pkg/redisconfigandpkg/bodylimit/httplimit(about 12 packages in total). Fix: list them all or say "several shared packages".README.md:222-231: the "How applications use it" section names "Stacklok Enterprise Platform" and "mecatl" as consumers. Nothing in the repo supports either (mecatlappears only as an example client ID indocs/arch/17). Please confirm both are meant to be named in a public README, or limit the section to ToolHive proxy and vMCP.README.md:126-128:OAuthRoutes/WellKnownRoutesare methods onserver/handlers.Handler(handler.go:333,510), andauthserver.Newdoesn't expose that type. A reader can't act on this as written. Fix: qualify them, or drop the sentence and point atServer.Handler().README.md:245: "device flow requires a single upstream" reads as a config constraint, but it is only checked at request time (server/handlers/device_verification.go:107); there is no startup validation. Fix: say enabling it with several upstreams fails at the verification step.
Simpler alternative: trim the two standards tables and the delegation/SPIFFE prose to a short supported-features list linking to docs/arch/17 and docs/arch/18. That cuts about a third of the file and most of the drift risk.
Not blocking, outside this diff: pkg/authserver/docs.go still says only in-memory storage exists and shows an UpstreamConfig{{Config: ...}} field that doesn't exist, so go doc readers will see the old version.
🤖 Reviewed with Claude Code
Incorporate review feedback on pkg/authserver/README.md without making it overly low-level: - Mount explicit /.well-known/* routes in the quick start so sibling well-known paths (such as RFC 9728 protected-resource metadata) are not shadowed. - Clarify that pkg/authserver has no MCP code dependency while following MCP defaults/validation (including required AllowedAudiences) and list its shared utility packages more accurately. - Qualify OAuthRoutes/WellKnownRoutes on handlers.Handler, note Unwrap() and optional capability interfaces for storage decorators/custom backends, note device flow's verification-time single-upstream check, and update ID-JAG to reflect that cnf/DPoP is rejected at both issuance and redemption. - Add a concise Package layout table showing which subpackages are standalone vs. Fosite grant factories. Co-authored-by: Mecatl <[email protected]>
Refresh pkg/authserver/docs.go so go doc matches the current API: fix the non-existent UpstreamConfig.Config field, document Redis alongside memory storage, mount explicit /.well-known/* routes, and update the supported flows and subpackage list. Co-authored-by: Mecatl <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7301 +/- ##
==========================================
- Coverage 81.95% 81.94% -0.01%
==========================================
Files 922 922
Lines 93367 93367
==========================================
- Hits 76521 76513 -8
- Misses 16841 16849 +8
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rdimitrov
left a comment
There was a problem hiding this comment.
Re-review of 7beae27: approve. The two new commits fix the factual problems from the earlier review, and I checked the new claims against the code.
- Well-known mount: resolved. The quick start mounts
/oauth/plus the explicit well-known paths, which matchesWellKnownRoutes. - Storage decorators: resolved. The README now says decorators must expose
Unwrap() storage.Storage, matchingserver_impl.go. - "No dependency on MCP": resolved. It now says "no code dependency" and notes that
AllowedAudiencesis required. - Shared packages: resolved. It says "several" and adds
pkg/auth/dcr, so the list is accurate. - Named consumers (Stacklok Enterprise Platform, mecatl): not resolved. This is a question, not a blocker: confirm you want these two names in a public README, or drop them.
OAuthRoutes/WellKnownRoutes: resolved. They are now qualified ashandlers.Handlermethods.- Device flow single upstream: resolved. The README now says multi-upstream deployments fail at verification, which matches the per-request 500 in
device_verification.go. - Stale
docs.go: resolved. The package doc is rewritten, and the example's types and fields exist.
Optional: the "can be imported independently" line lists storage, which still pulls in server (Fosite wiring). Either drop it from that list or say "without the root package".
🤖 Reviewed with Claude Code
Summary
Embedders of
pkg/authservercurrently have to read the code to learn what the package offers, how to mount it, and where the architecture docs live. This adds a README that serves as the single entry point for prospective adopters.pkg/authserveras an embeddable Go OAuth 2.0 authorization server built on Ory Fosite, with no MCP or ToolHive proxy dependency.authserver.Newandrunner.NewEmbeddedAuthServer).docs/arch/.Type of change
Test plan
Manual checks, all run locally:
pkg/authserver/server.go,config.go,runner/embeddedauthserver.go, and the threedocs/arch/pages), and that the#bound-id-jag-assertionsanchor matches a heading indocs/arch/17-token-exchange-delegation.md.authserver.Config(Issuer,AllowedAudiences,Upstreams),authserver.UpstreamConfig(Name,Type,OIDCConfig),upstream.OIDCConfig,storage.NewMemoryStorage, and theServermethods used in the example.Docs-only change, so no unit, e2e, or lint runs were needed.