# If authorization_info is not needed, remove the key_data
delsecurity_info_obj['authorization_info']
else:
current_app.logger.error("Bad format security method")
returnbad_request_error(detail="Bad format security method",cause="Bad format security method",invalid_params=[{"param":"securityMethod","reason":"Bad format security method"}])
@@ -176,6 +230,22 @@ class SecurityOperations(Resource):
returnnot_found_error(detail=f"Service with interfaceDescription {json.dumps(clean_empty(service_instance.interface_details.to_dict()))} not found",cause="Not found Service")
returnnot_found_error(detail=f"Service with interfaceDescription {json.dumps(clean_empty(service_instance.interface_details.to_dict()))} not found",cause="Not found Service")
# We obtain the interface security methods
# We obtain the interface security methods
# We need to go deeper here, because the interface description is an array
# and we need to find the correct one according to preferred security method by invoker,
# maybe Published API contains more than one interface description, and each one is related
# with a different security method, then we need to get a complete list (interface and related security methods)
# amd then we need to check if the preferred security method is compatible with the interface description
# also the security methods inside interface description is not mandatory, in that case we use aefProfile.securityMethods
# an also that aefProfile.securityMethods is not mandatory, only in cases described on TS 29222 - 8.2.4.2.4 Type: AefProfile -
#
# NOTE4:
# For AEFs defined by 3GPP interacting with API invokers via CAPIF-2e, at least one of the "securityMethods" attribute
# within this data type or the "securityMethods" attribute within the "interfaceDescriptions" attribute shall be present.
# For AEFs defined by 3GPP interacting with API invokers via CAPIF-2, the "securityMethods" attribute is optional.
# For AEFs not defined by 3GPP, the "securityMethods" attribute is optional.
#
# To achieve this, we need to setup at config which domains or IPs are CAPIF-2e or CAPIF-2, and then we need to check if the domain or IP of the service is in the list.