Loading services/TS29222_CAPIF_API_Invoker_Management_API/api_invoker_management/core/validate_user.py +4 −8 Original line number Original line Diff line number Diff line Loading @@ -6,7 +6,7 @@ from ..encoder import CustomJSONEncoder from ..models.problem_details import ProblemDetails from ..models.problem_details import ProblemDetails from ..util import serialize_clean_camel_case from ..util import serialize_clean_camel_case from .resources import Resource from .resources import Resource from .responses import internal_server_error from .responses import forbidden_error, internal_server_error, unauthorized_error class ControlAccess(Resource): class ControlAccess(Resource): Loading @@ -20,14 +20,10 @@ class ControlAccess(Resource): cert_entry = cert_col.find_one(my_query) cert_entry = cert_col.find_one(my_query) if cert_entry is None: if cert_entry is None: prob = ProblemDetails(title="Unauthorized", detail="User not authorized", cause="Certificate not found for invoker") return unauthorized_error(detail="Please provide an existing Network App ID", cause="Certificate not found for invoker") prob = serialize_clean_camel_case(prob) return Response(json.dumps(prob, cls=CustomJSONEncoder), status=401, mimetype="application/json") if cert_entry["cert_signature"] != cert_signature: if cert_entry["cert_signature"] != cert_signature: prob = ProblemDetails(title="Forbidden", detail="User not authorized", cause="You are not the owner of this resource") return forbidden_error(detail="User not authorized", cause="You are not the owner of this resource") prob = serialize_clean_camel_case(prob) return Response(json.dumps(prob, cls=CustomJSONEncoder), status=403, mimetype="application/json") except Exception as e: except Exception as e: exception = "An exception occurred in validate invoker" exception = "An exception occurred in validate invoker" Loading Loading
services/TS29222_CAPIF_API_Invoker_Management_API/api_invoker_management/core/validate_user.py +4 −8 Original line number Original line Diff line number Diff line Loading @@ -6,7 +6,7 @@ from ..encoder import CustomJSONEncoder from ..models.problem_details import ProblemDetails from ..models.problem_details import ProblemDetails from ..util import serialize_clean_camel_case from ..util import serialize_clean_camel_case from .resources import Resource from .resources import Resource from .responses import internal_server_error from .responses import forbidden_error, internal_server_error, unauthorized_error class ControlAccess(Resource): class ControlAccess(Resource): Loading @@ -20,14 +20,10 @@ class ControlAccess(Resource): cert_entry = cert_col.find_one(my_query) cert_entry = cert_col.find_one(my_query) if cert_entry is None: if cert_entry is None: prob = ProblemDetails(title="Unauthorized", detail="User not authorized", cause="Certificate not found for invoker") return unauthorized_error(detail="Please provide an existing Network App ID", cause="Certificate not found for invoker") prob = serialize_clean_camel_case(prob) return Response(json.dumps(prob, cls=CustomJSONEncoder), status=401, mimetype="application/json") if cert_entry["cert_signature"] != cert_signature: if cert_entry["cert_signature"] != cert_signature: prob = ProblemDetails(title="Forbidden", detail="User not authorized", cause="You are not the owner of this resource") return forbidden_error(detail="User not authorized", cause="You are not the owner of this resource") prob = serialize_clean_camel_case(prob) return Response(json.dumps(prob, cls=CustomJSONEncoder), status=403, mimetype="application/json") except Exception as e: except Exception as e: exception = "An exception occurred in validate invoker" exception = "An exception occurred in validate invoker" Loading