From 0722e4c5332c592b2279a8e8aeb6f45fa2476651 Mon Sep 17 00:00:00 2001 From: Mikko Ylinen Date: Fri, 13 Dec 2024 11:11:09 +0200 Subject: [PATCH] attestation-service: implement *_policy() methods for EAR token broker without the changes, kbs-client "set-attestation-policy" gets "not supported" errors. the changes are taken from 'simple' token broker. Both token brokers have a policy_engine instance created. Signed-off-by: Mikko Ylinen --- attestation-service/src/token/ear_broker.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/attestation-service/src/token/ear_broker.rs b/attestation-service/src/token/ear_broker.rs index cf3d6e511..6ed2ceb8b 100644 --- a/attestation-service/src/token/ear_broker.rs +++ b/attestation-service/src/token/ear_broker.rs @@ -299,6 +299,27 @@ impl AttestationTokenBroker for EarAttestationTokenBroker { Ok(signed_ear) } + + async fn set_policy(&self, policy_id: String, policy: String) -> Result<()> { + self.policy_engine + .set_policy(policy_id, policy) + .await + .map_err(Error::from) + } + + async fn list_policies(&self) -> Result> { + self.policy_engine + .list_policies() + .await + .map_err(Error::from) + } + + async fn get_policy(&self, policy_id: String) -> Result { + self.policy_engine + .get_policy(policy_id) + .await + .map_err(Error::from) + } } impl EarAttestationTokenBroker {