NabuCasa / pycognito

Python library for using AWS Cognito. With support for SRP.
Apache License 2.0
129 stars 39 forks source link

Cache request to .../.well-known/jwks.json #213

Closed Quasarman closed 2 months ago

Quasarman commented 1 year ago

Would it make sense to cache requests made to https://cognito-idp.{aws-region}.amazonaws.com/{user-pool-id}/.well-known/jwks.json since otherwise we would always make an request to get basically static data.

I know about the env variable COGNITO_JWKS but it does not feel right to hardcode this information inside an env variable. Ofcourse I could implement the caching outside of the Cognito class und set the env variable but why not have it directly inside instead?

pvizeli commented 1 year ago

sure, I'm fine with adding cache for it

ludeeus commented 2 months ago

This data is cached unless you recreate the Cognito object each time. https://github.com/NabuCasa/pycognito/blob/fffafc95e320403f51f65c19e4eb2e67832a8baf/pycognito/__init__.py#L218-L232