2828from .exception import OidcServiceError
2929from .oauth2 import Client
3030from .oauth2 .utils import pick_redirect_uri
31- from .oidc .registration import CALLBACK_URIS
32- from .oidc .registration import add_callbacks
3331from .util import add_path
3432from .util import dynamic_provider_info_discovery
3533from .util import load_registration_response
@@ -152,6 +150,9 @@ def init_client(self, issuer):
152150 :param issuer: An issuer ID
153151 :return: A Client instance
154152 """
153+
154+ logger .debug (20 * "*" + " init_client " + 20 * "*" )
155+
155156 try :
156157 _cnf = self .pick_config (issuer )
157158 except KeyError :
@@ -193,6 +194,7 @@ def do_provider_info(self, client=None, state='', behaviour_args=None):
193194 retrieved
194195 :return: issuer ID
195196 """
197+ logger .debug (20 * "*" + " do_provider_info " + 20 * "*" )
196198
197199 if not client :
198200 if state :
@@ -252,6 +254,8 @@ def do_client_registration(self, client=None,
252254 retrieved
253255 """
254256
257+ logger .debug (20 * "*" + " do_client_registration " + 20 * "*" )
258+
255259 if not client :
256260 if state :
257261 client = self .get_client_from_session_key (state )
@@ -291,6 +295,9 @@ def do_webfinger(self, user):
291295 request.
292296 :return: A Client instance
293297 """
298+
299+ logger .debug (20 * "*" + " do_webfinger " + 20 * "*" )
300+
294301 temporary_client = self .init_client ('' )
295302 temporary_client .do_request ('webfinger' , resource = user )
296303 return temporary_client
@@ -310,6 +317,8 @@ def client_setup(self, iss_id='', user='', behaviour_args=None):
310317 :return: A :py:class:`oidcrp.oidc.Client` instance
311318 """
312319
320+ logger .debug (20 * "*" + " client_setup " + 20 * "*" )
321+
313322 logger .info ('client_setup: iss_id={}, user={}' .format (iss_id , user ))
314323
315324 if not iss_id :
@@ -341,44 +350,6 @@ def client_setup(self, iss_id='', user='', behaviour_args=None):
341350 self .issuer2rp [issuer ] = client
342351 return client
343352
344- # def create_callbacks(self, issuer, request_uri=False, backchannel_logout_uri=False,
345- # frontchannel_logout_uri=False):
346- # """
347- # To mitigate some security issues the redirect_uris should be OP/AS
348- # specific. This method creates a set of redirect_uris unique to the
349- # OP/AS.
350- #
351- # :param frontchannel_logout_uri: Whether a front-channel logout uri should be constructed
352- # :param backchannel_logout_uri: Whether a back-channel logout uri should be constructed
353- # :param request_uri: Whether a request_uri should be constructed
354- # :param issuer: Issuer ID
355- # :return: A set of redirect_uris
356- # """
357- # _hash = hashlib.sha256()
358- # _hash.update(self.hash_seed)
359- # _hash.update(as_bytes(issuer))
360- # _hex = _hash.hexdigest()
361- # self.hash2issuer[_hex] = issuer
362- # res = {
363- # 'code': "{}/authz_cb/{}".format(self.base_url, _hex),
364- # 'implicit': "{}/authz_im_cb/{}".format(self.base_url, _hex),
365- # 'form_post': "{}/authz_fp_cb/{}".format(self.base_url, _hex),
366- # '__hex': _hex
367- # }
368- # if request_uri:
369- # res["request_uri"] = f"{self.base_url}/req_uri/{_hex}"
370- #
371- # if backchannel_logout_uri or frontchannel_logout_uri:
372- # res["post_logout_redirect_uris"] = f"{self.base_url}/session_logout/{_hex}"
373- #
374- # if backchannel_logout_uri:
375- # res["backchannel_logout_uri"] = f"{self.base_url}/bc_logout/{_hex}"
376- # if frontchannel_logout_uri:
377- # res["frontchannel_logout_uri"] = f"{self.base_url}/fc_logout/{_hex}"
378- #
379- # logger.debug(f"Created callback URIs: {res}")
380- # return res
381-
382353 def _get_response_type (self , context , req_args : Optional [dict ] = None ):
383354 if req_args :
384355 return req_args .get ("response_type" , context .get ('behaviour' )['response_types' ][0 ])
@@ -396,6 +367,9 @@ def init_authorization(self, client=None, state='', req_args=None, behaviour_arg
396367 URL and **state** the key to the session information in the
397368 state data store.
398369 """
370+
371+ logger .debug (20 * "*" + " init_authorization " + 20 * "*" )
372+
399373 if not client :
400374 if state :
401375 client = self .get_client_from_session_key (state )
@@ -517,7 +491,7 @@ def get_access_token(self, state, client: Optional[Client] = None):
517491 :return: A :py:class:`oidcmsg.oidc.AccessTokenResponse` or
518492 :py:class:`oidcmsg.oauth2.AuthorizationResponse`
519493 """
520- logger .debug ('get_accesstoken' )
494+ logger .debug (20 * "*" + " get_access_token " + 20 * "*" )
521495
522496 if client is None :
523497 client = self .get_client_from_session_key (state )
@@ -563,6 +537,9 @@ def refresh_access_token(self, state, client=None, scope=''):
563537 :param scope: What the returned token should be valid for.
564538 :return: A :py:class:`oidcmsg.oidc.AccessTokenResponse` instance
565539 """
540+
541+ logger .debug (20 * "*" + " refresh_access_token " + 20 * "*" )
542+
566543 if scope :
567544 req_args = {'scope' : scope }
568545 else :
@@ -599,6 +576,9 @@ def get_user_info(self, state, client=None, access_token='',
599576 :param kwargs: Extra keyword arguments
600577 :return: A :py:class:`oidcmsg.oidc.OpenIDSchema` instance
601578 """
579+
580+ logger .debug (20 * "*" + " get_user_info " + 20 * "*" )
581+
602582 if client is None :
603583 client = self .get_client_from_session_key (state )
604584
@@ -642,6 +622,9 @@ def finalize_auth(self, client, issuer: str, response: dict,
642622 :return: An :py:class:`oidcmsg.oidc.AuthorizationResponse` or
643623 :py:class:`oidcmsg.oauth2.AuthorizationResponse` instance.
644624 """
625+
626+ logger .debug (20 * "*" + " finalize_auth " + 20 * "*" )
627+
645628 _srv = client .get_service ('authorization' )
646629 try :
647630 authorization_response = _srv .parse_response (response ,
@@ -692,6 +675,8 @@ def get_access_and_id_token(self, authorization_response=None,
692675 was returned otherwise None.
693676 """
694677
678+ logger .debug (20 * "*" + " get_access_and_id_token " + 20 * "*" )
679+
695680 if client is None :
696681 client = self .get_client_from_session_key (state )
697682
@@ -910,6 +895,9 @@ def logout(self, state: str,
910895 should be used
911896 :return: A US
912897 """
898+
899+ logger .debug (20 * "*" + " logout " + 20 * "*" )
900+
913901 if client is None :
914902 client = self .get_client_from_session_key (state )
915903
@@ -933,6 +921,9 @@ def logout(self, state: str,
933921 def close (self , state : str ,
934922 issuer : Optional [str ] = '' ,
935923 post_logout_redirect_uri : Optional [str ] = '' ) -> dict :
924+
925+ logger .debug (20 * "*" + " close " + 20 * "*" )
926+
936927 if issuer :
937928 client = self .issuer2rp [issuer ]
938929 else :
0 commit comments