Skip to content

Commit c7c4a4e

Browse files
committed
feat: added configuration to opt-in trust param header
1 parent 87aab6c commit c7c4a4e

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

example/satosa/pyeudiw_backend.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ config:
209209
httpc_params: *httpc_params
210210
cache_ttl: 0
211211
entity_configuration_exp: 600
212+
# include_issued_jwt_header_param: true # default false; if true, it will include trust_chain header parameters in the signed presentation request issued by this trust handler
212213
metadata_type: "openid_credential_verifier"
213214
metadata: *metadata
214215
authority_hints:
@@ -248,6 +249,7 @@ config:
248249
config:
249250
# client_id: *client_id
250251
client_id_scheme: x509_san_dns # this will be prepended in the client id scheme used in the request.
252+
include_issued_jwt_header_param: true # default false; if true, it will include x5c header parameters in the signed presentation request issued by this trust handler
251253
certificate_authorities:
252254
- ca.example.com: |
253255
-----BEGIN CERTIFICATE-----

pyeudiw/tests/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ def base64url_to_int(val):
268268
ta_jwk.serialize(private=False),
269269
]
270270
},
271+
"include_issued_jwt_header_param": True,
271272
"default_sig_alg": "RS256",
272273
"federation_jwks": [
273274
jwk,
@@ -310,6 +311,7 @@ def base64url_to_int(val):
310311
"class": "X509Handler",
311312
"config": {
312313
"client_id": f"{BASE_URL}/OpenID4VP",
314+
"include_issued_jwt_header_param": True,
313315
"relying_party_certificate_chains_by_ca":{
314316
"ca.example.com": DEFAULT_X509_CHAIN,
315317
},

pyeudiw/trust/dynamic.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
UpsertMode = Union[Literal["update_first"], Literal["cache_first"]]
2121

22+
INCLUDE_JWT_HEADER_CONFIG_NAME = "include_issued_jwt_header_param"
23+
2224

2325
class CombinedTrustEvaluator(BaseLogger):
2426
"""
@@ -308,9 +310,9 @@ def get_jwt_header_trust_parameters(self, issuer: Optional[str] = None, force_up
308310
headers_params = {}
309311

310312
for handler in self.handlers:
311-
header = handler.extract_jwt_header_trust_parameters(trust_source)
312-
if header:
313-
headers_params.update(header)
313+
if getattr(handler, INCLUDE_JWT_HEADER_CONFIG_NAME, None):
314+
if header := handler.extract_jwt_header_trust_parameters(trust_source):
315+
headers_params.update(header)
314316
return headers_params
315317

316318
def build_metadata_endpoints(

pyeudiw/trust/handler/x509.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def validate_trust_material(
133133
self,
134134
x5c: list[str],
135135
trust_source: TrustSourceData,
136-
) -> dict[bool, TrustSourceData]:
136+
) -> tuple[bool, TrustSourceData]:
137137
chain = [base64.b64decode(b64der) for b64der in x5c]
138138

139139
if len(chain) > 1 and not verify_x509_attestation_chain(chain):

0 commit comments

Comments
 (0)