Skip to content

Commit

Permalink
fix: Trust Chain serialization due to a regression in v1.3.2 (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
peppelinux committed Mar 22, 2024
1 parent b10e65f commit 239b2e9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion spid_cie_oidc/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.4.2"
__version__ = "1.4.3"
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,12 @@ def test_trust_chain_valid_with_intermediary(self, mocked):
_p0 = unpad_jwt_payload(tc_ser[0])
_p1 = unpad_jwt_payload(tc_ser[1])
_p2 = unpad_jwt_payload(tc_ser[2])
_p3 = unpad_jwt_payload(tc_ser[3])

self.assertEqual(_p0['iss'], _p0['sub'])
self.assertNotEqual(_p2['iss'], _p1['sub'])
self.assertEqual(_p2['iss'], _p2['sub'])
self.assertNotEqual(_p2['iss'], _p2['sub'])
self.assertEqual(_p3['iss'], _p3['sub'])

dumps = dumps_statements_from_trust_chain_to_db(trust_chain)

Expand Down
7 changes: 3 additions & 4 deletions spid_cie_oidc/entity/trust_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,14 @@ def serialize(self):
if not isinstance(self.trust_anchor, str):
if (self.subject == stat.sub == stat.iss):
res.append(stat.jwt)
continue
elif (self.trust_anchor.sub == stat.sub == stat.iss):
ta_ec = stat.jwt
continue

if stat.verified_descendant_statements:
res.extend(
# [dict(i) for i in stat.verified_descendant_statements.values()]
[i for i in stat.verified_descendant_statements_as_jwt.values()]
[
i for i in stat.verified_descendant_statements_as_jwt.values()
]
)
if ta_ec:
res.append(ta_ec)
Expand Down

0 comments on commit 239b2e9

Please sign in to comment.