diff --git a/satosa_oidcop/idpy_oidcop.py b/satosa_oidcop/idpy_oidcop.py index 9cdecea..7b6a5f6 100644 --- a/satosa_oidcop/idpy_oidcop.py +++ b/satosa_oidcop/idpy_oidcop.py @@ -228,7 +228,7 @@ def _parse_request( logger.error(err) response = JsonResponse( {"error": "unauthorized_client", "error_description": str(err)}, - status="403", + status="403 Forbidden", ) return self.send_response(response) return parse_req @@ -265,7 +265,7 @@ def _process_request(self, endpoint, context: Context, parse_req, http_headers): "error": "invalid_request", "error_description": "request cannot be processed", }, - status="403", + status="403 Forbidden", ) return self.send_response(response) @@ -276,7 +276,7 @@ def _log_request(self, context: ExtendedContext, msg: str, level: str = "info"): getattr(logger, level)(logline) def handle_error( - self, msg: str = None, excp: Exception = None, status: str = "403" + self, msg: str = None, excp: Exception = None, status: str = "403 Forbidden" ): # pragma: no cover _msg = f'Something went wrong ... {excp or ""}' msg = msg or _msg @@ -380,7 +380,7 @@ def token_endpoint(self, context: ExtendedContext): "error": "invalid_request", "error_description": "Not owner of token", }, - status="403", + status="403 Forbidden", ) return self.send_response(_response) @@ -397,7 +397,7 @@ def token_endpoint(self, context: ExtendedContext): if isinstance(proc_req, JsonResponse): # pragma: no cover return self.send_response(proc_req) elif isinstance(proc_req, TokenErrorResponse): - return self.send_response(JsonResponse(proc_req.to_dict(), status="403")) + return self.send_response(JsonResponse(proc_req.to_dict(), status="403 Forbidden")) # TODO: remove when migrate to idpy-oidc # PATCH https://github.com/UniversitaDellaCalabria/SATOSA-oidcop/issues/29 @@ -433,7 +433,7 @@ def userinfo_endpoint(self, context: ExtendedContext): return self.send_response( JsonResponse( {"error": "invalid_client", "error_description": ""}, - status="403", + status="403 Forbidden", ) ) else: @@ -443,7 +443,7 @@ def userinfo_endpoint(self, context: ExtendedContext): return self.send_response( JsonResponse( {"error": "invalid_token", "error_description": ""}, - status="403", + status="403 Forbidden", ) ) @@ -455,7 +455,7 @@ def userinfo_endpoint(self, context: ExtendedContext): return self.send_response( JsonResponse( {"error": "invalid_token", "error_description": ""}, - status="403", + status="403 Forbidden", ) ) @@ -475,7 +475,7 @@ def userinfo_endpoint(self, context: ExtendedContext): proc_req["response_args"] if "response_args" in proc_req else proc_req.to_dict(), - status="403", + status="403 Forbidden", ) ) @@ -768,13 +768,13 @@ def _handle_backend_response(self, context: ExtendedContext, internal_resp): return self.handle_error(excp=excp) if isinstance(_args, ResponseMessage) and "error" in _args: # pragma: no cover - return self.send_response(JsonResponse(_args, status="403")) + return self.send_response(JsonResponse(_args, status="403 Forbidden")) elif isinstance( _args.get("response_args"), AuthorizationErrorResponse ): # pragma: no cover rargs = _args.get("response_args") logger.error(rargs) - response = JsonResponse(rargs.to_json(), status="403") + response = JsonResponse(rargs.to_json(), status="403 Forbidden") return self.send_response(response) info = endpoint.do_response(request=parse_req, **proc_req)