Expand description
Optional bearer-token authentication for the compute/parse routes.
Authentication is off by default so the public viewer -> server flow
keeps working. When Config::api_token is set (via IFC_SERVER_API_TOKEN
or API_TOKEN), the protected routes require an
Authorization: Bearer <token> header and return 401 Unauthorized
otherwise. The health endpoint is intentionally left unprotected so this
layer never applies to it.
Functionsยง
- constant_
time_ ๐eq - Length-aware constant-time byte comparison to avoid leaking the token via
early-exit timing. Returns
falseimmediately on length mismatch (the length itself is not secret), then folds all remaining bytes. - require_
bearer_ token - Axum middleware enforcing optional bearer-token auth on protected routes.
- unauthorized ๐
- The
401: the shared error envelope plus theWWW-Authenticatechallenge naming the scheme this layer accepts.