From 463a9297683618aa9aadb9f23bd95c44f1dabd08 Mon Sep 17 00:00:00 2001 From: peppelinux Date: Mon, 21 Aug 2023 17:52:19 +0200 Subject: [PATCH] fix: added Json response on failed trust evaluation on WIA --- pyeudiw/satosa/backend.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pyeudiw/satosa/backend.py b/pyeudiw/satosa/backend.py index 1972b9cc..2e02a4a0 100644 --- a/pyeudiw/satosa/backend.py +++ b/pyeudiw/satosa/backend.py @@ -381,13 +381,25 @@ def _validate_trust(self, context: Context, jws: str) -> TrustEvaluationHelper: f"{trust_eval.entity_id}" ) ) - - is_trusted = trust_eval.evaluation_method() - if not is_trusted: - raise NotTrustedFederationError( - f"{trust_eval.entity_id} is not trusted" + + is_trusted = None + try: + is_trusted = trust_eval.evaluation_method() + except Exception as e: + _err_msg = ( + "Trust evaluation failed" ) - + # raise NotTrustedFederationError( + # f"{trust_eval.entity_id} is not trusted" + # ) + return JsonResponse( + { + "error": "invalid_param", + "error_description": "Wallet Provider is not Trusted" + }, + status="403" + ) + return trust_eval def redirect_endpoint(self, context, *args):