04-discovery

command
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

04: AS Metadata Discovery

Non-UI · No infrastructure needed · RFC 8414

Auto-discover the AS's endpoints (token, JWKS, introspection, registration) from a single well-known URL — same mechanism Keycloak, Auth0, and Authlete use. The walkthrough also shows the same client.DiscoverAS() call working against Keycloak (when running).

Two-process architecture

main.go boots an auth server with the full discovery surface (/.well-known/openid-configuration, token, JWKS, introspection, registration) plus a resource server. With --serve, both bind on real ports — any client can do curl /.well-known/openid-configuration and go from there.

Quick start

make demo                              # interactive walkthrough
make serve                             # auth :8081, resource :8082
curl -s http://localhost:8081/.well-known/openid-configuration | jq

Optional: side-by-side with Keycloak

cd ..  && make upkcl                   # boots Keycloak on :8280
cd 04-discovery && make demo           # the last step compares both

See WALKTHROUGH.md for the full step-by-step.

Targets

make … What
demo (default) Walkthrough with TUI renderer
demo-plain Plain renderer
demo-ci Non-interactive
serve Bind AS + RS on real ports
walkthrough Regenerate WALKTHROUGH.md

What's next

05 — Introspection — RS validates tokens by asking the AS instead of decoding the JWT itself.

Documentation

Overview

Example 04: AS Metadata Discovery (RFC 8414).

In Examples 01-03 we hardcoded URLs like authServer.URL+"/api/token". In production, clients discover endpoints automatically from a single well-known URL — same mechanism Keycloak / Auth0 / Authlete use.

Two-process architecture:

make serve   # auth :8081 (full discovery surface), resource :8082
make demo    # walkthrough that drives both

See: https://www.rfc-editor.org/rfc/rfc8414

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL