@@ -145,27 +145,27 @@ def extract_and_update_trust_materials(
145145 self , issuer : str , trust_source : TrustSourceData
146146 ) -> TrustSourceData :
147147 # Return the first valid chain
148-
149- for ca , chain in self .relying_party_certificate_chains_by_ca .items ():
150- if not self ._verify_chain (chain ):
151- logger .error (f"Invalid x509 certificate chain using CA { ca } . Chain will be ignored" )
152- continue
153-
154- exp = get_expiry_date_from_x5c (chain )
155-
156- trust_source .add_trust_param (
157- X509Handler ._TRUST_TYPE ,
158- TrustEvaluationType (
159- attribute_name = "x5c" ,
160- x5c = to_pem_list (chain ),
161- expiration_date = exp ,
162- jwks = self .private_keys ,
163- trust_handler_name = self .name ,
148+ if issuer == self .client_id :
149+ for ca , chain in self .relying_party_certificate_chains_by_ca .items ():
150+ if not self ._verify_chain (chain ):
151+ logger .error (f"Invalid x509 certificate chain using CA { ca } . Chain will be ignored" )
152+ continue
153+
154+ exp = get_expiry_date_from_x5c (chain )
155+
156+ trust_source .add_trust_param (
157+ X509Handler ._TRUST_TYPE ,
158+ TrustEvaluationType (
159+ attribute_name = "x5c" ,
160+ x5c = to_pem_list (chain ),
161+ expiration_date = exp ,
162+ jwks = self .private_keys ,
163+ trust_handler_name = self .name ,
164+ )
164165 )
165- )
166166
167- return trust_source
168-
167+ return trust_source
168+
169169 return trust_source
170170
171171 def validate_trust_material (
0 commit comments