@@ -489,7 +489,7 @@ def get_client_authn_method(client, endpoint):
489489 else : # a list
490490 return am [0 ]
491491
492- def get_access_token (self , state , client : Optional [Client ] = None ):
492+ def get_tokens (self , state , client : Optional [Client ] = None ):
493493 """
494494 Use the 'accesstoken' service to get an access token from the OP/AS.
495495
@@ -499,7 +499,7 @@ def get_access_token(self, state, client: Optional[Client] = None):
499499 :return: A :py:class:`oidcmsg.oidc.AccessTokenResponse` or
500500 :py:class:`oidcmsg.oauth2.AuthorizationResponse`
501501 """
502- logger .debug (20 * "*" + " get_access_token " + 20 * "*" )
502+ logger .debug (20 * "*" + " get_tokens " + 20 * "*" )
503503
504504 if client is None :
505505 client = self .get_client_from_session_key (state )
@@ -699,8 +699,7 @@ def get_access_and_id_token(self, authorization_response=None,
699699 if not state :
700700 state = authorization_response ['state' ]
701701
702- authreq = _context .state .get_item (
703- AuthorizationRequest , 'auth_request' , state )
702+ authreq = _context .state .get_item (AuthorizationRequest , 'auth_request' , state )
704703 _resp_type = set (authreq ['response_type' ])
705704
706705 access_token = None
@@ -712,11 +711,10 @@ def get_access_and_id_token(self, authorization_response=None,
712711 if _resp_type in [{'token' }, {'id_token' , 'token' }, {'code' , 'token' },
713712 {'code' , 'id_token' , 'token' }]:
714713 access_token = authorization_response ["access_token" ]
715- if behaviour_args and behaviour_args .get ("collect_id_token" , False ):
716- if "id_token" not in _resp_type :
717- logger .debug ("Collect ID Token" )
718- # get the access token
719- token_resp = self .get_access_token (state , client = client )
714+ if behaviour_args :
715+ if behaviour_args .get ("collect_tokens" , False ):
716+ # get what you can from the token endpoint
717+ token_resp = self .get_tokens (state , client = client )
720718 if is_error_message (token_resp ):
721719 return False , "Invalid response %s." % token_resp ["error" ]
722720 # Now which access_token should I use
@@ -726,7 +724,7 @@ def get_access_and_id_token(self, authorization_response=None,
726724
727725 elif _resp_type in [{'code' }, {'code' , 'id_token' }]:
728726 # get the access token
729- token_resp = self .get_access_token (state , client = client )
727+ token_resp = self .get_tokens (state , client = client )
730728 if is_error_message (token_resp ):
731729 return False , "Invalid response %s." % token_resp ["error" ]
732730
0 commit comments