Skip to content

Commit

Permalink
chore: Added trust chain structure test
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoe Maas committed Sep 18, 2024
1 parent 7d04028 commit a5876ea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ fun readAuthorityHints(jwt: String? = null, partyBId: String? = null, engine: Ht
JsonMapper().mapEntityStatement(requestEntityStatement(it, engine))
}

entityConfigurationStatement?.metadata?.get("federation_entity")?.jsonObject?.get("federation_fetch_endpoint")?.let { url ->
requestEntityStatement(url.toString(), engine).let { jwt -> subordinateStatement.add(jwt) }
}

entityConfigurationStatement?.authorityHints?.forEach { authorityHint ->
buildTrustChain(authorityHint, engine, subordinateStatements, trustChains, subordinateStatement = subordinateStatement)
}
Expand All @@ -53,7 +49,7 @@ fun buildTrustChain(
requestEntityStatement(authorityHint, engine).run {
JsonMapper().mapEntityStatement(this)?.let {
if (it.authorityHints.isNullOrEmpty()) {
it.metadata?.get("federation_entity")?.jsonObject?.get("federation_fetch_endpoint")?.let { url ->
it.metadata?.get("federation_entity")?.jsonObject?.get("federation_fetch_endpoint")?.jsonPrimitive?.content.let { url ->
requestEntityStatement(url.toString(), engine).let { jwt -> subordinateStatement.add(jwt) }
}
trustChain.add(it)
Expand All @@ -63,7 +59,7 @@ fun buildTrustChain(
it.authorityHints ?: subordinateStatement.clear()
} else {
it.authorityHints?.forEach { hint ->
it.metadata?.get("federation_entity")?.jsonObject?.get("federation_fetch_endpoint")?.let { url ->
it.metadata?.get("federation_entity")?.jsonObject?.get("federation_fetch_endpoint")?.jsonPrimitive?.content.let { url ->
requestEntityStatement(url.toString(), engine).let { jwt -> subordinateStatement.add(jwt) }
}
trustChain.add(it)
Expand Down
Loading

0 comments on commit a5876ea

Please sign in to comment.