The authorization endpoint (RFC 6749 §4.1.1, OAuth 2.1) and the consent decision that goes with it.
Mounted by Noizu.MCP.Auth.Server.Router at GET /oauth/authorize and
POST /oauth/consent. Needs a session pipeline (it redirects a browser through
your login and renders a form) but must not require an authenticated user —
resolving that is this endpoint's job.
The flow
- Validate the request.
client_idresolves to a client (a stored one, or a CIMD document fetched under the SSRF guard);redirect_urimatches one the client registered. Until both hold, every error is a rendered page — never a redirect. Afterwards, errors go back to the validated URI as?error=, which is what a client needs to fail cleanly. - PKCE, mandatory.
code_challengewithcode_challenge_method=S256. Absent orplainisinvalid_request, for confidential clients too. - Park the request. Everything is written to login state under a random
key; only that key travels in URLs, so no scope, challenge or
stateends up in the host's access logs. - Authenticate the human through
Noizu.MCP.Auth.Server.Upstream— normally the host's own session. Not logged in ⇒ redirect to the host's login with areturn_tothat lands back here. - Consent, mandatory for registered and CIMD clients, CSRF-protected, and re-prompted when the requested scope broadens.
- Issue the code and redirect with
code, the client'sstate, andiss(RFC 9207).
An inbound Authorization header is never consulted for identity: an access
token this server issued must not be usable to mint another.
Summary
Functions
GET /oauth/authorize. Also the landing point after the host's login, which
comes back carrying login_state.
POST /oauth/consent — the approve/deny decision from the consent form.
Functions
@spec authorize(Plug.Conn.t(), Noizu.MCP.Auth.Server.Config.t() | keyword()) :: Plug.Conn.t()
GET /oauth/authorize. Also the landing point after the host's login, which
comes back carrying login_state.
@spec consent(Plug.Conn.t(), Noizu.MCP.Auth.Server.Config.t() | keyword()) :: Plug.Conn.t()
POST /oauth/consent — the approve/deny decision from the consent form.