<div dir="ltr">To be able to gracefully rotate the realm keys periodically a realm needs to have more than one keypair. One keypair that is active and will be used to issue new cookies and tokens. Also, one or more keypairs that are inactive that can be used to verify old cookies and tokens.<div><br></div><div>I&#39;m going to start work on this soon, but here&#39;s some initial thoughts:</div><div><br></div><div>* Realm keys will have a list of keypairs rather than just one. Only one can be active. There will also be an expiration time on the inactive keypairs. Once expired and inactive keypair is no longer usable.</div><div>* There will also be an option to automatically generate a new key every N days.</div><div>* If a session cookie is signed with an inactive pair the cookie will be refreshed so it&#39;s signed with the active keypair</div><div>* Token introspect endpoint will allow any token that is signed with any keypair that is not expired</div><div>* If a refresh token is signed with an inactive pair the new tokens (including refresh token) will be signed with the active keypair</div><div>* Secret used to generate client code will be linked to the keypair. I&#39;ll need a way to specify what secret it was signed with so codes are still valid even if they where signed with an old.</div><div><br></div><div>This is only for login cookie and OIDC protocol. Is it even necessary to have support for multiple certificates for SAML? SAML doesn&#39;t have a token introspection or refresh of the assertions right, so not sure it&#39;s needed.</div><div><br></div><div>With regards to the applications. Marek has already added support for clients to fetch new keypairs for the realm. See his email on keycloak-dev for details around that.</div></div>