Skip to content

Commit e20bcf9

Browse files
committed
adding dev-v0.12.10 tag to this commit to ensure building
1 parent ec71216 commit e20bcf9

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

html/supertokens_python/recipe/session/with_jwt/recipe_implementation.html

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,16 @@ <h1 class="title">Module <code>supertokens_python.recipe.session.with_jwt.recipe
187187
if decoded_payload is None or decoded_payload.get(&#34;exp&#34;) is None:
188188
raise Exception(&#34;Error reading JWT from session&#34;)
189189

190-
jwt_expiry = 1
191-
if &#34;exp&#34; in decoded_payload:
192-
exp = decoded_payload[&#34;exp&#34;]
193-
if exp &gt; current_time_in_seconds:
194-
# it can come here if someone calls this function well after
195-
# the access token and the jwt payload have expired. In this case,
196-
# we still want the jwt payload to update, but the resulting JWT should
197-
# not be alive for too long (since it&#39;s expired already). So we set it to
198-
# 1 second lifetime.
199-
jwt_expiry = exp - current_time_in_seconds
190+
jwt_expiry = decoded_payload.get(&#34;exp&#34;, 0) - current_time_in_seconds
191+
# pylint: disable=consider-using-max-builtin
192+
if jwt_expiry &lt; 1:
193+
# it can come here if someone calls this function well after
194+
# the access token and the jwt payload have expired. In this case,
195+
# we still want the jwt payload to update, but the resulting JWT should
196+
# not be alive for too long (since it&#39;s expired already). So we set it to
197+
# 1 second lifetime.
198+
jwt_expiry = 1
199+
# pylint: enable=consider-using-max-builtin
200200

201201
new_access_token_payload = await add_jwt_to_access_token_payload(
202202
access_token_payload=new_access_token_payload,
@@ -405,16 +405,16 @@ <h2 class="section-title" id="header-functions">Functions</h2>
405405
if decoded_payload is None or decoded_payload.get(&#34;exp&#34;) is None:
406406
raise Exception(&#34;Error reading JWT from session&#34;)
407407

408-
jwt_expiry = 1
409-
if &#34;exp&#34; in decoded_payload:
410-
exp = decoded_payload[&#34;exp&#34;]
411-
if exp &gt; current_time_in_seconds:
412-
# it can come here if someone calls this function well after
413-
# the access token and the jwt payload have expired. In this case,
414-
# we still want the jwt payload to update, but the resulting JWT should
415-
# not be alive for too long (since it&#39;s expired already). So we set it to
416-
# 1 second lifetime.
417-
jwt_expiry = exp - current_time_in_seconds
408+
jwt_expiry = decoded_payload.get(&#34;exp&#34;, 0) - current_time_in_seconds
409+
# pylint: disable=consider-using-max-builtin
410+
if jwt_expiry &lt; 1:
411+
# it can come here if someone calls this function well after
412+
# the access token and the jwt payload have expired. In this case,
413+
# we still want the jwt payload to update, but the resulting JWT should
414+
# not be alive for too long (since it&#39;s expired already). So we set it to
415+
# 1 second lifetime.
416+
jwt_expiry = 1
417+
# pylint: enable=consider-using-max-builtin
418418

419419
new_access_token_payload = await add_jwt_to_access_token_payload(
420420
access_token_payload=new_access_token_payload,

html/supertokens_python/recipe/session/with_jwt/session_class.html

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,16 @@ <h1 class="title">Module <code>supertokens_python.recipe.session.with_jwt.sessio
9898
if decoded_payload is None or decoded_payload.get(&#34;exp&#34;) is None:
9999
raise Exception(&#34;Error reading JWT from session&#34;)
100100

101-
jwt_expiry = 1
102-
if &#34;exp&#34; in decoded_payload:
103-
exp = decoded_payload[&#34;exp&#34;]
104-
if exp &gt; current_time_in_seconds:
105-
# it can come here if someone calls this function well after
106-
# the access token and the jwt payload have expired. In this case,
107-
# we still want the jwt payload to update, but the resulting JWT should
108-
# not be alive for too long (since it&#39;s expired already). So we set it to
109-
# 1 second lifetime.
110-
jwt_expiry = exp - current_time_in_seconds
101+
jwt_expiry = decoded_payload.get(&#34;exp&#34;, 0) - current_time_in_seconds
102+
# pylint: disable=consider-using-max-builtin
103+
if jwt_expiry &lt; 1:
104+
# it can come here if someone calls this function well after
105+
# the access token and the jwt payload have expired. In this case,
106+
# we still want the jwt payload to update, but the resulting JWT should
107+
# not be alive for too long (since it&#39;s expired already). So we set it to
108+
# 1 second lifetime.
109+
jwt_expiry = 1
110+
# pylint: enable=consider-using-max-builtin
111111

112112
new_access_token_payload = await add_jwt_to_access_token_payload(
113113
access_token_payload=new_access_token_payload,
@@ -179,16 +179,16 @@ <h2 class="section-title" id="header-functions">Functions</h2>
179179
if decoded_payload is None or decoded_payload.get(&#34;exp&#34;) is None:
180180
raise Exception(&#34;Error reading JWT from session&#34;)
181181

182-
jwt_expiry = 1
183-
if &#34;exp&#34; in decoded_payload:
184-
exp = decoded_payload[&#34;exp&#34;]
185-
if exp &gt; current_time_in_seconds:
186-
# it can come here if someone calls this function well after
187-
# the access token and the jwt payload have expired. In this case,
188-
# we still want the jwt payload to update, but the resulting JWT should
189-
# not be alive for too long (since it&#39;s expired already). So we set it to
190-
# 1 second lifetime.
191-
jwt_expiry = exp - current_time_in_seconds
182+
jwt_expiry = decoded_payload.get(&#34;exp&#34;, 0) - current_time_in_seconds
183+
# pylint: disable=consider-using-max-builtin
184+
if jwt_expiry &lt; 1:
185+
# it can come here if someone calls this function well after
186+
# the access token and the jwt payload have expired. In this case,
187+
# we still want the jwt payload to update, but the resulting JWT should
188+
# not be alive for too long (since it&#39;s expired already). So we set it to
189+
# 1 second lifetime.
190+
jwt_expiry = 1
191+
# pylint: enable=consider-using-max-builtin
192192

193193
new_access_token_payload = await add_jwt_to_access_token_payload(
194194
access_token_payload=new_access_token_payload,

0 commit comments

Comments
 (0)