[AUSF] Handle UEAuthentication DELETE

This commit is contained in:
mitmitmitm 2022-11-28 10:31:49 +01:00 committed by Sukchan Lee
parent bdc9c1373f
commit 4ec5dedaf4
8 changed files with 132 additions and 11 deletions

View File

@ -133,6 +133,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
}
}
break;
CASE(OGS_SBI_HTTP_METHOD_DELETE)
CASE(OGS_SBI_HTTP_METHOD_PUT)
if (message.h.resource.component[1]) {
ausf_ue = ausf_ue_find_by_ctx_id(

View File

@ -112,3 +112,19 @@ bool ausf_nausf_auth_handle_authenticate_confirmation(ausf_ue_t *ausf_ue,
return true;
}
bool ausf_nausf_auth_handle_authenticate_delete(ausf_ue_t *ausf_ue,
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
{
ogs_assert(ausf_ue);
ogs_assert(stream);
ogs_assert(recvmsg);
ogs_assert(true ==
ausf_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NUDM_UEAU, NULL,
ausf_nudm_ueau_build_auth_removal_ind,
ausf_ue, stream, NULL));
return true;
}

View File

@ -30,6 +30,8 @@ bool ausf_nausf_auth_handle_authenticate(ausf_ue_t *ausf_ue,
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
bool ausf_nausf_auth_handle_authenticate_confirmation(ausf_ue_t *ausf_ue,
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
bool ausf_nausf_auth_handle_authenticate_delete(ausf_ue_t *ausf_ue,
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
#ifdef __cplusplus
}

View File

@ -117,3 +117,56 @@ end:
return request;
}
ogs_sbi_request_t *ausf_nudm_ueau_build_auth_removal_ind(
ausf_ue_t *ausf_ue, void *data)
{
ogs_sbi_message_t message;
ogs_sbi_request_t *request = NULL;
OpenAPI_auth_event_t *AuthEvent = NULL;
ogs_assert(ausf_ue);
memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_PUT;
message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NUDM_UEAU;
message.h.api.version = (char *)OGS_SBI_API_V1;
message.h.resource.component[0] = ausf_ue->supi;
message.h.resource.component[1] = (char *)OGS_SBI_RESOURCE_NAME_AUTH_EVENTS;
AuthEvent = ogs_calloc(1, sizeof(*AuthEvent));
if (!AuthEvent) {
ogs_error("No AuthEvent");
goto end;
}
AuthEvent->time_stamp = ogs_sbi_localtime_string(ogs_time_now());
if (!AuthEvent->time_stamp) {
ogs_error("No time_stamp");
goto end;
}
AuthEvent->nf_instance_id = NF_INSTANCE_ID(ogs_sbi_self()->nf_instance);
AuthEvent->success = true;
AuthEvent->auth_type = ausf_ue->auth_type;
AuthEvent->serving_network_name = ausf_ue->serving_network_name;
AuthEvent->is_auth_removal_ind = true;
AuthEvent->auth_removal_ind = true;
message.AuthEvent = AuthEvent;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
end:
if (AuthEvent) {
if (AuthEvent->time_stamp)
ogs_free(AuthEvent->time_stamp);
ogs_free(AuthEvent);
}
return request;
}

View File

@ -29,6 +29,8 @@ extern "C" {
ogs_sbi_request_t *ausf_nudm_ueau_build_get(ausf_ue_t *ausf_ue, void *data);
ogs_sbi_request_t *ausf_nudm_ueau_build_result_confirmation_inform(
ausf_ue_t *ausf_ue, void *data);
ogs_sbi_request_t *ausf_nudm_ueau_build_auth_removal_ind(
ausf_ue_t *ausf_ue, void *data);
#ifdef __cplusplus
}

View File

@ -214,6 +214,25 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
return true;
}
bool ausf_nudm_ueau_handle_auth_removal_ind(ausf_ue_t *ausf_ue,
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
{
ogs_sbi_message_t sendmsg;
ogs_sbi_response_t *response = NULL;
ogs_assert(ausf_ue);
ogs_assert(stream);
ausf_ue_remove(ausf_ue);
memset(&sendmsg, 0, sizeof(sendmsg));
response = ogs_sbi_build_response(&sendmsg, OGS_SBI_HTTP_STATUS_NO_CONTENT);
ogs_assert(response);
ogs_assert(true == ogs_sbi_server_send_response(stream, response));
return true;
}
bool ausf_nudm_ueau_handle_result_confirmation_inform(ausf_ue_t *ausf_ue,
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
{

View File

@ -30,6 +30,8 @@ bool ausf_nudm_ueau_handle_get(ausf_ue_t *ausf_ue,
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
bool ausf_nudm_ueau_handle_result_confirmation_inform(ausf_ue_t *ausf_ue,
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
bool ausf_nudm_ueau_handle_auth_removal_ind(ausf_ue_t *ausf_ue,
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
#ifdef __cplusplus
}
#endif

View File

@ -98,6 +98,15 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
OGS_FSM_TRAN(s, ausf_ue_state_exception);
}
break;
CASE(OGS_SBI_HTTP_METHOD_DELETE)
handled = ausf_nausf_auth_handle_authenticate_delete(
ausf_ue, stream, message);
if (!handled) {
ogs_error("[%s] Cannot handle SBI message",
ausf_ue->suci);
OGS_FSM_TRAN(s, ausf_ue_state_exception);
}
break;
DEFAULT
ogs_error("[%s] Invalid HTTP method [%s]",
ausf_ue->suci, message->h.method);
@ -136,20 +145,37 @@ void ausf_ue_state_operational(ogs_fsm_t *s, ausf_event_t *e)
break;
}
SWITCH(message->h.resource.component[1])
CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION)
ausf_nudm_ueau_handle_get(ausf_ue, stream, message);
break;
SWITCH(message->h.method)
CASE(OGS_SBI_HTTP_METHOD_PUT)
SWITCH(message->h.resource.component[1])
CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS)
ausf_nudm_ueau_handle_auth_removal_ind(
ausf_ue, stream, message);
break;
CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS)
ausf_nudm_ueau_handle_result_confirmation_inform(
ausf_ue, stream, message);
DEFAULT
ogs_error("[%s] Invalid HTTP method [%s]",
ausf_ue->suci, message->h.method);
ogs_assert_if_reached();
END
break;
DEFAULT
ogs_error("[%s] Invalid HTTP method [%s]",
ausf_ue->suci, message->h.method);
ogs_assert_if_reached();
SWITCH(message->h.resource.component[1])
CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION)
ausf_nudm_ueau_handle_get(ausf_ue, stream, message);
break;
CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS)
ausf_nudm_ueau_handle_result_confirmation_inform(
ausf_ue, stream, message);
break;
DEFAULT
ogs_error("[%s] Invalid HTTP method [%s]",
ausf_ue->suci, message->h.method);
ogs_assert_if_reached();
END
break;
END
break;