Skip to content

Commit d3cd314

Browse files
committed
[IMP]fastapi_auth_jwt: Allow to not renew the cookie in the responses.
1 parent 7afbd96 commit d3cd314

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fastapi_auth_jwt/dependencies.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _get_jwt_payload(
7070
validator.cookie_name,
7171
)
7272
raise UnauthorizedMissingCookie()
73-
return validator._decode(cookie_token, secret=validator._get_jwt_cookie_secret())
73+
return validator._decode(cookie_token, cookie_secret=True)
7474

7575

7676
def _get_jwt_payload_and_validator(
@@ -95,15 +95,14 @@ def _get_jwt_payload_and_validator(
9595
raise list(exceptions.values())[0]
9696
raise UnauthorizedCompositeJwtError(exceptions)
9797

98-
if validator.cookie_enabled:
98+
if validator.cookie_enabled and validator.renew_cookie_on_response:
9999
if not validator.cookie_name:
100100
_logger.info("Cookie name not set for validator %s", validator.name)
101101
raise ConfigurationError()
102102
response.set_cookie(
103103
key=validator.cookie_name,
104104
value=validator._encode(
105105
payload,
106-
secret=validator._get_jwt_cookie_secret(),
107106
expire=validator.cookie_max_age,
108107
),
109108
max_age=validator.cookie_max_age,

0 commit comments

Comments
 (0)