#[non_exhaustive]pub struct FakeJwksServer {
pub url: String,
pub base: String,
pub hits: Arc<AtomicUsize>,
pub routes: Arc<Mutex<HashMap<String, (&'static str, String)>>>,
pub delay_ms: Arc<AtomicU64>,
/* private fields */
}testing only.Expand description
A throwaway loopback HTTP server standing in for the authorization server, counting hits. Hand-rolled so the crate needs no HTTP-mock dependency.
routes maps a request path to (status line, body) and can be changed while
the server runs (key rotation tests); a path with no route gets the fallback,
or a 404 when there is none. Every response is application/json.
#[non_exhaustive]: get one from spawn_jwks_server or
spawn_http_server; a field may be added without a breaking change.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.url: Stringhttp://127.0.0.1:<port>/jwks.
base: Stringhttp://127.0.0.1:<port>, for building issuer and discovery URLs.
hits: Arc<AtomicUsize>Requests answered so far.
routes: Arc<Mutex<HashMap<String, (&'static str, String)>>>Path → (status line, body), e.g. ("200 OK", jwks_body()).
delay_ms: Arc<AtomicU64>Milliseconds to stall before answering — a slow IdP. Read when a connection is accepted, so a change applies to the next request.