@@ -100,6 +100,30 @@ change this class to derive from ``oauthlib.openid.Server`` instead of
100100With ``RSA `` key-pairs, the public key can be generated from the private key,
101101so there is no need to add a setting for the public key.
102102
103+
104+ Rotating the RSA private key
105+ ~~~~~~~~~~~~~~~~~~~~~~~~
106+ Extra keys can be published in the jwks_uri with the ``OIDC_RSA_PRIVATE_KEYS_INACTIVE ``
107+ setting. For example:::
108+
109+ OAUTH2_PROVIDER = {
110+ "OIDC_RSA_PRIVATE_KEY": os.environ.get("OIDC_RSA_PRIVATE_KEY"),
111+ "OIDC_RSA_PRIVATE_KEYS_INACTIVE": [
112+ os.environ.get("OIDC_RSA_PRIVATE_KEY_2"),
113+ os.environ.get("OIDC_RSA_PRIVATE_KEY_3")
114+ ]
115+ # ... other settings
116+ }
117+
118+ To rotate, follow these steps:
119+
120+ #. Generate a new key, and add it to the inactive set. Then deploy the app.
121+ #. Swap the active and inactive keys, then re-deploy.
122+ #. After some reasonable amount of time, remove the inactive key. At a minimum,
123+ you should wait ``ID_TOKEN_EXPIRE_SECONDS `` to ensure the key isn't removed
124+ before valid tokens expire.
125+
126+
103127Using ``HS256 `` keys
104128~~~~~~~~~~~~~~~~~~~~
105129
@@ -297,7 +321,7 @@ query, and other details.
297321JwksInfoView
298322~~~~~~~~~~~~
299323
300- Available at ``/o/.well-known/jwks.json ``, this view provides details of the key used to sign
324+ Available at ``/o/.well-known/jwks.json ``, this view provides details of the keys used to sign
301325the JWTs generated for ID tokens, so that clients are able to verify them.
302326
303327
0 commit comments