This repository was archived by the owner on Jun 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -452,6 +452,13 @@ def get_session_info(
452452
453453 return res
454454
455+ def _compatible_sid (self , sid ):
456+ # To be backward compatible is this an old time sid
457+ p = self .unpack_session_key (sid )
458+ if len (p ) == 3 :
459+ sid = self .encrypted_session_id (* p )
460+ return sid
461+
455462 def get_session_info_by_token (
456463 self ,
457464 token_value : str ,
@@ -468,10 +475,8 @@ def get_session_info_by_token(
468475 if not sid :
469476 raise WrongTokenClass
470477
471- # To be backward compatible is this an oldtime sid
472- p = self .unpack_session_key (sid )
473- if len (p ) == 3 :
474- sid = self .encrypted_session_id (* p )
478+ # To be backward compatible is this an old time sid
479+ sid = self ._compatible_sid (sid )
475480
476481 return self .get_session_info (
477482 sid ,
@@ -484,7 +489,8 @@ def get_session_info_by_token(
484489
485490 def get_session_id_by_token (self , token_value : str ) -> str :
486491 _token_info = self .token_handler .info (token_value )
487- return _token_info ["sid" ]
492+ sid = _token_info .get ("sid" )
493+ return self ._compatible_sid (sid )
488494
489495 def add_grant (self , user_id : str , client_id : str , ** kwargs ) -> Grant :
490496 """
You can’t perform that action at this time.
0 commit comments