forgejo-mcp-broker/internal/oauth
Ole-Morten Duesund fee12a2ac0 feat(oauth): /.well-known discovery endpoints (forgejo-mcp-broker-b2o)
Adds RFC 8414 (oauth-authorization-server) and RFC 9728 (oauth-
protected-resource) metadata documents.

Both URLs are derived from cfg.Issuer at construction time, never from
inbound request headers. Test TestDiscovery_IssuerIgnoresHostHeader
explicitly probes this — a malicious Host: evil.example.com value must
not leak into the published metadata. Defense against the OAuth
metadata-spoofing class starts at the discovery layer.

Capabilities published reflect the actual OAuth surface:
  - response_types_supported = ["code"]
  - grant_types_supported = ["authorization_code", "refresh_token"]
  - code_challenge_methods_supported = ["S256"]   (PKCE only, no plain)
  - token_endpoint_auth_methods_supported = ["none"]   (PKCE-only public clients)

Protected-resource metadata advertises /mcp as the resource; phase 5
will mount the gated MCP endpoint there.

Closes forgejo-mcp-broker-b2o.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 17:08:12 +02:00
..
oauth.go feat(oauth): /.well-known discovery endpoints (forgejo-mcp-broker-b2o) 2026-04-27 17:08:12 +02:00
oauth_internal_test.go feat(oauth): authorization-server endpoints (forgejo-mcp-broker-pur) 2026-04-27 17:04:34 +02:00
oauth_test.go feat(oauth): /.well-known discovery endpoints (forgejo-mcp-broker-b2o) 2026-04-27 17:08:12 +02:00