Skip to content

Support a TTL for rp.NewRemoteKeySet cache #747

@strideynet

Description

@strideynet

Preflight Checklist

  • I could not find a solution in the existing issues, docs, nor discussions
  • I have joined the ZITADEL chat

Describe your problem

An issuer may remove decide to rotate out a key used to sign OIDC ID Tokens. This may be on a regular-basis, or may be performed in response to a security incident.

The implementation of RemoteKeySet usefully performs some caching of the JWKS, however, if an issuer rotates a key, this will not be reflected until the RemoteKeySet receives a kid that it does not recognise. The RemoteKeySet will continue to verify ID tokens signed with a key that the issuer has rotated, potentially, forever.

Describe your ideal solution

A CacheTTL option that could be provided to NewRemoteKeySet that would set a maximum time for which the cached values would be used without performing a fresh fetch from the remote.

e.g

rp.NewRemoteKeySet(client, jwksUrl, rp.CacheTTL(time.Hour))

Version

N/A

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Gathering community feedback

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions