-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add cache control for jwks endpoint #429
Conversation
supertokens_python/querier.py
Outdated
res: Dict[str, Any] = {"_headers": dict(response.headers)} | ||
|
||
if response.headers.get("content-type").startswith("text"): | ||
res["_text"] = response.text | ||
|
||
try: | ||
return response.json() | ||
res.update(response.json()) | ||
except JSONDecodeError: | ||
return response.text | ||
pass | ||
|
||
return res |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried with creating a QuerierResponse class as well but that will require too many changes throughout the codebase. Plus, we aren't actually using response.text anywhere. So made it (response.text) part of the dict response.
supertokens_python/querier.py
Outdated
if response.headers.get("content-type", "").startswith("text"): | ||
res["_text"] = response.text | ||
|
||
try: | ||
return response.json() | ||
res.update(response.json()) | ||
except JSONDecodeError: | ||
return response.text | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is changing the semantics of how things were done. Please fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -40,8 +40,9 @@ class CreateJwtResultUnsupportedAlgorithm: | |||
|
|||
|
|||
class GetJWKSResult: | |||
def __init__(self, keys: List[JsonWebKey]): | |||
def __init__(self, keys: List[JsonWebKey], validity_in_secs: Optional[int]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def __init__(self, keys: List[JsonWebKey], validity_in_secs: Optional[int]): | |
def __init__(self, keys: List[JsonWebKey], validity_in_secs: Optional[int] = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Merged 0.16 |
Summary of change
Add cache control for jwks endpoint
Related issues
Checklist for important updates
coreDriverInterfaceSupported.json
file has been updated (if needed)supertokens_python/constants.py
frontendDriverInterfaceSupported.json
file has been updated (if needed)setup.py
supertokens_python/constants.py
git tag
) in the formatvX.Y.Z
, and then find the latest branch (git branch --all
) whoseX.Y
is greater than the latest released tag.supertokens_python/utils.py
file to include that in theFRAMEWORKS
variablesyncio
/asyncio
functions are consistent.tests/sessions/test_access_token_version.py
to account for any new claims that are optional or omitted by the core