feat(19.4-01): neutral wristband resource default and OIDC provider docs

- DefaultOptions().Resource is empty; comments name the host application,
  no consuming application (folded todo)
- Tests set an explicit neutral resource; TestDefaultOptionsResourceEmpty
- wristband README: new summary, two flavours, OIDC usage, API reference,
  OIDC defaults, dependencies, testing; root README row matches
- docs/services/oauth-server.md: OpenID Connect provider section;
  Resource described as required with an empty default
- ExampleNewOIDCServer and the newOIDCServer docs region
This commit is contained in:
2026-10-19 18:32:03 +02:00
parent e25e73378c
commit ddda59a12b
12 changed files with 274 additions and 66 deletions

View File

@@ -1,9 +1,11 @@
// Package wristband implements the app-agnostic RFC 8414 / OAuth
// authorization-server surface ported from Płytarium's hand-rolled PHP OAuth
// server (08-CONTEXT.md D-05). It never imports an application package, a
// GORM type, or any fonoteka model: every deployment-specific value (issuer,
// scopes, endpoint paths, TTLs) arrives through Options, and every app-owned
// concern (users, collections, persistence) stays out of this package.
// Package wristband implements the app-agnostic OAuth authorization-server
// surface: the MCP flavour (RFC 8414 metadata, RFC 7591 registration,
// authorization code with PKCE, refresh rotation) ported from a hand-rolled
// PHP OAuth server (08-CONTEXT.md D-05), and the OpenID Connect flavour
// (19.4). It never imports an application package, a GORM type or any
// application model: every deployment-specific value (issuer, scopes,
// endpoint paths, TTLs) arrives through Options, and every concern of the
// host application (users, persistence, pages) stays out of this package.
//
// D-06: PHP's RFC-minimal response shapes are wristband's defaults. There
// are no response hooks; callers cannot alter the wire bytes beyond the
@@ -58,10 +60,12 @@ type Options struct {
// before JSON decoding (D-21, T-08-DCR-FLOOD). PHP default: 65536 (64 KiB).
RegisterMaxBodyBytes int64
// Resource is the expected RFC 8707 resource indicator value authorize
// checks an optional resource query parameter against (PHP
// config('fonoteka.mcp.resource'), D-03). PHP default:
// "https://mcp.plytarium.com/mcp".
// Resource is the expected RFC 8707 resource indicator value the MCP
// authorize endpoint checks an optional resource query parameter
// against. It has no default: the host application sets the URL of the
// resource its tokens are for. While it is empty, a request that sends
// resource is refused with invalid_target and a request without it is
// unaffected. The OIDC flavour ignores resource.
Resource string
// PendingRequestTTL is how long a pre-consent pending authorization row
@@ -87,7 +91,8 @@ type Options struct {
}
// DefaultOptions returns PHP-parity defaults for every metadata option
// other than Issuer, which the caller must set from app.url.
// other than Issuer, which the caller must set from app.url, and Resource,
// which the host application must set for its deployment.
func DefaultOptions() Options {
return Options{
ServiceDocumentationPath: "/help",
@@ -97,9 +102,8 @@ func DefaultOptions() Options {
DCRClientCap: 200,
DCRUnconsentedSweepAge: 24 * time.Hour,
RegisterMaxBodyBytes: 65536,
Resource: "https://mcp.plytarium.com/mcp",
PendingRequestTTL: 600 * time.Second,
CodeTTL: 600 * time.Second,
CodeTTL: 600 * time.Second,
AccessTokenTTL: 3600 * time.Second,
RefreshTokenTTL: 30 * 24 * time.Hour,
}