pub async fn discover(
client: &Client,
issuer: &str,
) -> Result<Discovery, OidcError>Expand description
Fetch and validate the realm’s OpenID discovery document.
Three checks, because everything downstream trusts what this returns with a refresh token attached:
- The issuer must be
https, unless it is loopback. A plaintext issuer would POST the long-livedoffline_accessrefresh token in clear text. Loopback is exempt so local Keycloak development works. - The document’s self-reported
issuermust match the one we asked for (both canonicalised). Otherwise a redirect or a copy-pasted wrong realm silently mints tokens the TraceVault server will reject, with no clue why. - Every endpoint must share the issuer’s ORIGIN. A misconfigured or tampered document could otherwise name an unrelated host as the token endpoint and collect the refresh token there.