File tree Expand file tree Collapse file tree 4 files changed +18
-1
lines changed
supertokens_python/recipe/session Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 41
41
get_session_from_request ,
42
42
refresh_session_in_request ,
43
43
)
44
+ from ..constants import protected_props
44
45
from ..utils import get_required_claim_validators
45
46
46
47
from supertokens_python .recipe .multitenancy .constants import DEFAULT_TENANT_ID
@@ -106,6 +107,10 @@ async def create_new_session_without_request_response(
106
107
107
108
final_access_token_payload = {** access_token_payload , "iss" : issuer }
108
109
110
+ for prop in protected_props :
111
+ if prop in final_access_token_payload :
112
+ del final_access_token_payload [prop ]
113
+
109
114
for claim in claims_added_by_other_recipes :
110
115
update = await claim .build (user_id , tenant_id , user_context )
111
116
final_access_token_payload = {** final_access_token_payload , ** update }
Original file line number Diff line number Diff line change 42
42
"parentRefreshTokenHash1" ,
43
43
"refreshTokenHash1" ,
44
44
"antiCsrfToken" ,
45
+ "rsub" ,
45
46
"tId" ,
46
47
]
Original file line number Diff line number Diff line change 47
47
from supertokens_python import AppInfo
48
48
49
49
from .interfaces import SessionContainer
50
+ from .constants import protected_props
50
51
from supertokens_python .querier import Querier
51
52
from supertokens_python .recipe .multitenancy .constants import DEFAULT_TENANT_ID
52
53
@@ -378,8 +379,13 @@ async def merge_into_access_token_payload(
378
379
if session_info is None :
379
380
return False
380
381
382
+ new_access_token_payload = session_info .custom_claims_in_access_token_payload
383
+ for k in protected_props :
384
+ if k in new_access_token_payload :
385
+ del new_access_token_payload [k ]
386
+
381
387
new_access_token_payload = {
382
- ** session_info . custom_claims_in_access_token_payload ,
388
+ ** new_access_token_payload ,
383
389
** access_token_payload_update ,
384
390
}
385
391
for k in access_token_payload_update .keys ():
Original file line number Diff line number Diff line change 60
60
set_request_in_user_context_if_not_defined ,
61
61
)
62
62
from supertokens_python .supertokens import Supertokens
63
+ from .constants import protected_props
63
64
64
65
if TYPE_CHECKING :
65
66
from supertokens_python .recipe .session .recipe import SessionRecipe
@@ -240,6 +241,10 @@ async def create_new_session_in_request(
240
241
241
242
final_access_token_payload = {** access_token_payload , "iss" : issuer }
242
243
244
+ for prop in protected_props :
245
+ if prop in final_access_token_payload :
246
+ del final_access_token_payload [prop ]
247
+
243
248
for claim in claims_added_by_other_recipes :
244
249
update = await claim .build (user_id , tenant_id , user_context )
245
250
final_access_token_payload = {** final_access_token_payload , ** update }
You can’t perform that action at this time.
0 commit comments