diff --git a/crates/iz-web/src/oidc.rs b/crates/iz-web/src/oidc.rs index 5a73442..ea36a28 100644 --- a/crates/iz-web/src/oidc.rs +++ b/crates/iz-web/src/oidc.rs @@ -2,7 +2,7 @@ //! credentials token that iz uses to read the people directory (section 2.6). //! //! It finds `im`'s endpoints through discovery and keeps them for an hour. It keeps `im`'s signing -//! keys (JWKS) for an hour, and refetches them at most once a minute when a token names a key that +//! keys (JWKS) for ten minutes, and refetches them at most once a minute when a token names a key that //! is not known. It exchanges authorization codes, and it verifies ID tokens and logout tokens. //! //! It decides nothing about who may sign in: that is `pages/sign_in.rs` and the store. It keeps no @@ -52,7 +52,7 @@ pub const MAX_RESPONSE_BYTES: usize = 256 * 1024; /// How long discovery is cached, before it is fetched again. const DISCOVERY_TTL: Duration = Duration::from_secs(3600); /// How long the JWKS is cached, before it is fetched again (contracts.md 2.2). -const KEYS_TTL: Duration = Duration::from_secs(3600); +const KEYS_TTL: Duration = Duration::from_secs(600); /// The shortest gap between two JWKS fetch attempts (contracts.md 2.2). It bounds the refetch for unknown /// key ids, and the retries after a failed fetch, so an unreachable `im` is not asked once per request. const UNKNOWN_KEY_REFETCH: Duration = Duration::from_secs(60); diff --git a/docs/contracts.md b/docs/contracts.md index f08fbad..1878e49 100644 --- a/docs/contracts.md +++ b/docs/contracts.md @@ -60,7 +60,7 @@ Clients fetch discovery once at boot and cache it. They may hard-code the paths the last 7 days, as `{"kty":"OKP","crv":"Ed25519","x":...,"kid":...,"use":"sig","alg":"EdDSA"}`. - `im` rotates the signing key every 90 days and on admin demand. A new key is published 24 hours before it signs anything. -- Clients cache the JWKS for 1 hour, and refetch at most once a minute when a token names an unknown `kid`. +- Clients cache the JWKS for 10 minutes, and refetch at most once a minute when a token names an unknown `kid`. ### 2.3 Sign-in (authorization code + PKCE)