Skip to content

Commit

Permalink
fix: moved exception handling from dpop/strust eval and return json e…
Browse files Browse the repository at this point in the history
…rror
  • Loading branch information
peppelinux committed Aug 21, 2023
1 parent 0064ef8 commit de961ef
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions pyeudiw/satosa/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,30 +638,29 @@ def request_endpoint(self, context, *args):

# check DPOP for WIA if any
dpop_validation_error = None
_err_msg = (
f"Trust evaluation failed"
)
try:
dpop_validation_error = self._request_endpoint_dpop(context)
if dpop_validation_error:
raise Exception(_err_msg)
except Exception as e:
_err_msg = (
f"Trust evaluation failed: {e}"
)
return JsonResponse(
{
"error": "invalid_param",
"error_description": "Wallet Provider is not Trusted"
},
status="403"
)

if dpop_validation_error:
self._log(
context,
level='error',
message=(
"[DPoP VALIDATION ERROR] "
f"{context.headers}"
f"{_err_msg} {context.headers}: {e}"
)
)
return dpop_validation_error
return JsonResponse(
{
"error": "invalid_param",
"error_description": "WIA evalution error: Wallet Provider is not Trusted"
},
status="403"
)

try:
state = context.qs_params["id"]
Expand Down

0 comments on commit de961ef

Please sign in to comment.