@@ -941,6 +941,7 @@ def complete_add_credential_wallet(self, credentials_presenting: list[dict]):
941941
942942 return {"success" : True , "data" : {"credential_id" : credential_id }}
943943
944+ # @TODO Update this method to handle the complete flow to login into the wallet and present the credential to the RP
944945 def loginToVerifier (self , clientId : str , requestUri : str , requestUriMethod : str , state : str ):
945946 """
946947 Metodo pubblico per effettuare il login ad un Relying Party / Verifier, incluso fetch dell'EC del Relying Party / Verifier.
@@ -950,32 +951,31 @@ def loginToVerifier(self, clientId: str, requestUri: str, requestUriMethod: str,
950951 self.session["rp_state"]
951952 self.session["rp_response_uri"]
952953 """
953- logger .info (
954- "➡️ Richiesta di login presso il Relying Party / Verifier %s" ,
955- sanitize_for_logging (clientId ),
956- )
954+
955+
956+ logger .info (f"Entering method: loginToVerifier. Params [client_id: { clientId } , request_uri: { requestUri } , requestUriMethod: { requestUriMethod } , state: { state } ]" )
957957
958958 session_id = self .session .get ("session_id" )
959959 if not session_id :
960960 raise ValueError ("Sessione non inizializzata" )
961961
962- # recupero del response_mode relativo al presentation flow dalla configurazione e sua validazione
963- presentation_response_mode = extract_claim (current_app .config , "metadata.presentation_flow.response_mode" )
964-
965- presentation_response_mode_supported = [PRESENTATION_RESPONSE_MODE_DIRECT_POST_JWT ]
966- if presentation_response_mode not in presentation_response_mode_supported :
967- raise ValueError (
968- f"Il response_mode '{ presentation_response_mode } ' configurato per la presentazione delle credenziali del wallet non è supportato, i valori ammessi sono: { presentation_response_mode_supported } "
969- )
970-
971- # recupero del response_type relativo al presentation flow dalla configurazione e sua validazione
972- presentation_response_type = extract_claim (current_app .config , "metadata.presentation_flow.response_type" )
973-
974- presentation_response_type_supported = [PRESENTATION_RESPONSE_TYPE_VP_TOKEN ]
975- if presentation_response_type not in presentation_response_type_supported :
976- raise ValueError (
977- f"Il response_type '{ presentation_response_type } ' configurato per l'inizializzazione del wallet non è supportato, i valori ammessi sono: { presentation_response_type_supported } "
978- )
962+ # # recupero del response_mode relativo al presentation flow dalla configurazione e sua validazione
963+ # presentation_response_mode = extract_claim(current_app.config, "metadata.presentation_flow.response_mode")
964+ #
965+ # presentation_response_mode_supported = [PRESENTATION_RESPONSE_MODE_DIRECT_POST_JWT]
966+ # if presentation_response_mode not in presentation_response_mode_supported:
967+ # raise ValueError(
968+ # f"Il response_mode '{presentation_response_mode}' configurato per la presentazione delle credenziali del wallet non è supportato, i valori ammessi sono: {presentation_response_mode_supported}"
969+ # )
970+ #
971+ # # recupero del response_type relativo al presentation flow dalla configurazione e sua validazione
972+ # presentation_response_type = extract_claim(current_app.config, "metadata.presentation_flow.response_type")
973+ #
974+ # presentation_response_type_supported = [PRESENTATION_RESPONSE_TYPE_VP_TOKEN]
975+ # if presentation_response_type not in presentation_response_type_supported:
976+ # raise ValueError(
977+ # f"Il response_type '{presentation_response_type}' configurato per l'inizializzazione del wallet non è supportato, i valori ammessi sono: {presentation_response_type_supported}"
978+ # )
979979
980980 country = app_state .selected_country
981981 query_trust_root = f"ms_trust_configuration.{ country } .trust_root"
@@ -984,32 +984,17 @@ def loginToVerifier(self, clientId: str, requestUri: str, requestUriMethod: str,
984984 if not trust_root_url :
985985 raise ValueError (f"Nessun Trust root per il paese { country } " )
986986
987- logger .info (
988- "ℹ️ Trust root individuato per il paese %s: %s" ,
989- sanitize_for_logging (country ),
990- sanitize_for_logging (trust_root_url ),
991- )
992-
993- # recupero EC del verifier
994- logger .info (
995- "➡️ Entity ID del Relying Party / Verifier: %s" ,
996- sanitize_for_logging (clientId ),
997- )
987+ logger .info (f"query_trust_root: { query_trust_root } " )
998988
999989 # Richiama il metodo privato per ottenere l'EC, validarlo e recuperne il payload
1000990 external_verifier_ec = self ._entity_configuration_management (
1001991 clientId , [METADATA_TYPE_FEDERATION_ENTITY , METADATA_TYPE_CREDENTIAL_VERIFIER ], trust_root_url
1002992 )
1003993
1004- logger .info (
1005- f"✅ Scaricato e validato l'Entity Configuration dell'entità { clientId } di tipo { METADATA_TYPE_CREDENTIAL_VERIFIER } "
1006- )
994+ logger .info (f"EC for { clientId } validated successfully with metadata types: { [METADATA_TYPE_FEDERATION_ENTITY , METADATA_TYPE_CREDENTIAL_VERIFIER ]} " )
1007995
1008996 # Salvataggio in memoria Flask external_verifier_ec
1009997 app_state .ec_store .add (clientId , external_verifier_ec )
1010- logger .info (
1011- f"✅ Salvato in memoria il payload dell'Entity Configuration dell'entità { clientId } di tipo { METADATA_TYPE_CREDENTIAL_VERIFIER } "
1012- )
1013998
1014999 # Build authorization query string
10151000 params = {
@@ -1020,20 +1005,13 @@ def loginToVerifier(self, clientId: str, requestUri: str, requestUriMethod: str,
10201005 }
10211006 query_string = f"?{ urlencode (params )} "
10221007
1023- logger .info (
1024- "🚀 Invio Request_uri request al Request_uri endpoint %s" ,
1025- sanitize_for_logging (requestUri ),
1026- )
1027- # Effettua una request_uri request
1008+ logger .info (f"send request: { requestUri } " )
1009+
10281010 request_uri_response = request_request_uri (
10291011 url = requestUri , query_string = query_string , proxies = self .proxies , no_proxy_domains = self .no_proxy_domains
10301012 )
10311013
1032- logger .info (
1033- "✅ Ricevuta risposta dal Request_uri endpoint %s" ,
1034- sanitize_for_logging (requestUri ),
1035- )
1036- logger .info ("%s" , sanitize_for_logging (request_uri_response ))
1014+ logger .info (f"response: { request_uri_response } " )
10371015
10381016 if not is_jwt (request_uri_response ):
10391017 raise ValueError ("La Request_uri response ricevuta dal Relying Party / Verifier non è un JWT" )
@@ -1044,9 +1022,6 @@ def loginToVerifier(self, clientId: str, requestUri: str, requestUriMethod: str,
10441022 if not verifier_jwks :
10451023 raise ValueError (f"Non trovata in memoria alcuna chiave JWK del Relying Party / Verifier { clientId } " )
10461024
1047- logger .debug ("🔑 JWKs trovato:" )
1048- logger .debug ("%s" , sanitize_for_logging (json .dumps (verifier_jwks , indent = 2 , ensure_ascii = False )))
1049-
10501025 try :
10511026 request_uri_response_jwt_payload = decode_and_verify_jwt (request_uri_response , verifier_jwks )
10521027 credentialsRequested , rp_state , rp_nonce , rp_response_uri = parse_rp_authorization_request (
0 commit comments