Commit a4ffe97d authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Code cleanup

parent 4ec32d29
...@@ -89,11 +89,11 @@ void DefaultApiImpl::rg_authentications_post( ...@@ -89,11 +89,11 @@ void DefaultApiImpl::rg_authentications_post(
void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put( void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put(
const std::string& authCtxId, const ConfirmationData& confirmationData, const std::string& authCtxId, const ConfirmationData& confirmationData,
Pistache::Http::ResponseWriter& response) { Pistache::Http::ResponseWriter& response) {
uint16_t http_response_code = 0; Pistache::Http::Code code = {};
nlohmann::json json_data = {}; nlohmann::json json_data = {};
m_ausf_app->handle_ue_authentications_confirmation( m_ausf_app->handle_ue_authentications_confirmation(
authCtxId, confirmationData, json_data, http_response_code); authCtxId, confirmationData, json_data, code);
// ausf --> seaf // ausf --> seaf
Logger::ausf_server().debug( Logger::ausf_server().debug(
...@@ -101,7 +101,7 @@ void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put( ...@@ -101,7 +101,7 @@ void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put(
Logger::ausf_server().info( Logger::ausf_server().info(
"Send 5g-aka-confirmation response to SEAF (Code 200)"); "Send 5g-aka-confirmation response to SEAF (Code 200)");
response.send(Pistache::Http::Code(http_response_code), json_data.dump()); response.send(code, json_data.dump());
} }
void DefaultApiImpl::ue_authentications_deregister_post( void DefaultApiImpl::ue_authentications_deregister_post(
...@@ -121,20 +121,20 @@ void DefaultApiImpl::ue_authentications_post( ...@@ -121,20 +121,20 @@ void DefaultApiImpl::ue_authentications_post(
// Getting params // Getting params
std::string reponse_from_udm; std::string reponse_from_udm;
std::string location; std::string location;
uint16_t http_response_code = 0; // uint16_t http_response_code = 0;
UEAuthenticationCtx ue_auth_ctx = {}; UEAuthenticationCtx ue_auth_ctx = {};
nlohmann::json UEAuthCtx_json = {}; nlohmann::json UEAuthCtx_json = {};
Pistache::Http::Code code = {};
m_ausf_app->handle_ue_authentications( m_ausf_app->handle_ue_authentications(
authenticationInfo, UEAuthCtx_json, location, http_response_code); authenticationInfo, UEAuthCtx_json, location, code);
Logger::ausf_server().debug( Logger::ausf_server().debug(
"Auth response:\n %s", UEAuthCtx_json.dump().c_str()); "Auth response:\n %s", UEAuthCtx_json.dump().c_str());
Logger::ausf_server().info("Send Auth response to SEAF (Code 201)"); Logger::ausf_server().info("Send Auth response to SEAF (Code 201)");
response.headers().add<Pistache::Http::Header::Location>(location); response.headers().add<Pistache::Http::Header::Location>(location);
response.send( response.send(code,
Pistache::Http::Code(http_response_code), // Created
UEAuthCtx_json.dump()); // Type: json object to string UEAuthCtx_json.dump()); // Type: json object to string
} }
......
This diff is collapsed.
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "UEAuthenticationCtx.h" #include "UEAuthenticationCtx.h"
#include "ConfirmationData.h" #include "ConfirmationData.h"
#include "ausf.h" #include "ausf.h"
#include <pistache/http.h>
#include <map> #include <map>
#include <shared_mutex> #include <shared_mutex>
...@@ -75,11 +76,11 @@ class ausf_app { ...@@ -75,11 +76,11 @@ class ausf_app {
void handle_ue_authentications( void handle_ue_authentications(
const AuthenticationInfo& authenticationInfo, nlohmann::json& json_data, const AuthenticationInfo& authenticationInfo, nlohmann::json& json_data,
std::string& location, uint16_t& http_response_code); std::string& location, Pistache::Http::Code& code);
void handle_ue_authentications_confirmation( void handle_ue_authentications_confirmation(
const std::string& authCtxId, const ConfirmationData& confirmation_data, const std::string& authCtxId, const ConfirmationData& confirmation_data,
nlohmann::json& json_data, uint16_t& http_response_code); nlohmann::json& json_data, Pistache::Http::Code& code);
bool is_supi_2_security_context(const std::string& supi) const; bool is_supi_2_security_context(const std::string& supi) const;
std::shared_ptr<security_context> supi_2_security_context( std::shared_ptr<security_context> supi_2_security_context(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment