Skip to main content

discover

Function discover 

Source
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:

  1. The issuer must be https, unless it is loopback. A plaintext issuer would POST the long-lived offline_access refresh token in clear text. Loopback is exempt so local Keycloak development works.
  2. The document’s self-reported issuer must match the one we asked for (both canonicalised). Otherwise a redirect or a copy-pasted wrong realm silently mints tokens the Visdom server will reject, with no clue why.
  3. 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.