will JWKS for verifying signature of Cognito access token expire?

0

I am storing the JWK Set for my user pool locally in server and comparing it against the accessToken from cognto to verify the request. I have doubt whether the JWKS have any sort of validity and become void after expiry?

1回答
0
承認された回答

As stated in this page, Amazon Cognito does rotate signing keys. Your local JWK Set will get stale and it won't validate the access token signed with a rorated key in the user pool.

Amazon Cognito might rotate signing keys in your user pool. As a best practice, cache public keys in your app, using the kid as a cache key, and refresh the cache periodically. Compare the kid in the tokens that your app receives to your cache.

profile picture
HS
回答済み 7ヶ月前
  • Hi Thanks, In that case, How ofteen should I update the JWKS data?

  • Hi Thanks, In that case, How ofteen should I update the JWKS data?

  • As stated in the documentation, you need to compare your kid in your local JWK Set with the kid in the token. If they don't match, then AWS should have rotated the key and its the time to refresh the cache. To provide maximum availability, you should compare the kid on every validation.

    If you receive a token with the correct issuer but a different kid, Amazon Cognito might have rotated the signing key. Refresh the cache from your user pool jwks_uri endpoint.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ