Thank you for this great library. I am new to this so may have misunderstood the flows that are normal here.
If I understand the client API, a CoreClient has limited lifespan because the identity provider's underlying configuration may change underneath it, for instance if the identity provider rotates its keys each day.
To deal with this, the best practice seems to be to cache the discovery document and JWKS responses based on HTTP cache-control header max-age value, in order to avoid the need to revalidate that information in connection with each authentication.
For example, the Google OpenID Connect writeup says that:
You may be able to avoid an HTTP round-trip by caching the values from the Discovery document. Standard HTTP caching headers are used and should be respected.
The caching headers in the responses do not seem to be exposed via openidconnect::ProviderMetadata::discover or other high-level functions that are currently provided by the library.
Is the best way to get it currently to re-implement functionality similar to discover/discover_async and capture it through the HTTP client? Is there a recommended practice for keeping clients current in lieu of doing this?
Thank you for this great library. I am new to this so may have misunderstood the flows that are normal here.
If I understand the client API, a
CoreClienthas limited lifespan because the identity provider's underlying configuration may change underneath it, for instance if the identity provider rotates its keys each day.To deal with this, the best practice seems to be to cache the discovery document and JWKS responses based on HTTP cache-control header max-age value, in order to avoid the need to revalidate that information in connection with each authentication.
For example, the Google OpenID Connect writeup says that:
The caching headers in the responses do not seem to be exposed via
openidconnect::ProviderMetadata::discoveror other high-level functions that are currently provided by the library.Is the best way to get it currently to re-implement functionality similar to
discover/discover_asyncand capture it through the HTTP client? Is there a recommended practice for keeping clients current in lieu of doing this?