Commit 2456a500 authored by HFJ's avatar HFJ

aka auth json.exception.parse_error.101

parent 4ec402db
......@@ -12,6 +12,9 @@
#include "AuthenticationResultDeletionApi.h"
#include "Helpers.h"
#include <iostream>
using namespace std;
namespace org {
namespace openapitools {
......@@ -81,6 +84,7 @@ void AuthenticationResultDeletionApi::delete_eap_authentication_result_handler(c
}
void AuthenticationResultDeletionApi::authentication_result_deletion_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
cout << "----------authentication_result_deletion_api_default_handler------------" << endl;
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist-resDel");
}
......
......@@ -36,10 +36,10 @@ void DefaultApi::init() {
void DefaultApi::setupRoutes() {
using namespace Pistache::Rest;
//Routes::Post(*router, base + "/ue-authentications/:authCtxId/eap-session", Routes::bind(&DefaultApi::eap_auth_method_handler, this));
//Routes::Post(*router, base + "/rg-authentications", Routes::bind(&DefaultApi::rg_authentications_post_handler, this));
//Routes::Put(*router, base + "/ue-authentications/:authCtxId/5g-aka-confirmation", Routes::bind(&DefaultApi::ue_authentications_auth_ctx_id5g_aka_confirmation_put_handler, this));
//Routes::Post(*router, base + "/ue-authentications/deregister", Routes::bind(&DefaultApi::ue_authentications_deregister_post_handler, this));
Routes::Post(*router, base + "/ue-authentications/:authCtxId/eap-session", Routes::bind(&DefaultApi::eap_auth_method_handler, this));
Routes::Post(*router, base + "/rg-authentications", Routes::bind(&DefaultApi::rg_authentications_post_handler, this));
Routes::Put(*router, base + "/ue-authentications/:authCtxId/5g-aka-confirmation", Routes::bind(&DefaultApi::ue_authentications_auth_ctx_id5g_aka_confirmation_put_handler, this));
Routes::Post(*router, base + "/ue-authentications/deregister", Routes::bind(&DefaultApi::ue_authentications_deregister_post_handler, this));
Routes::Post(*router, base + "/ue-authentications", Routes::bind(&DefaultApi::ue_authentications_post_handler, this));
// Default handler, called when a route is not found
......@@ -95,8 +95,9 @@ void DefaultApi::rg_authentications_post_handler(const Pistache::Rest::Request &
}
void DefaultApi::ue_authentications_auth_ctx_id5g_aka_confirmation_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
// Getting the path params
auto authCtxId = request.param(":authCtxId").as<std::string>();
cout << "5gaka confirmation received with authctxID %s" << authCtxId.c_str() << endl;
// Getting the body param
......@@ -143,16 +144,24 @@ void DefaultApi::ue_authentications_deregister_post_handler(const Pistache::Rest
}
void DefaultApi::ue_authentications_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
cout << "------------ue authentications post handler---------"<< endl;
if(!request.body().c_str()){
cout << "empty request body" << endl;
}
// Getting the body param
AuthenticationInfo authenticationInfo;
try {
cout << "--try module"<< endl;
nlohmann::json::parse(request.body()).get_to(authenticationInfo);
cout << "parsed successfully"<< endl;
this->ue_authentications_post(authenticationInfo, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
cout << "**400 error"<< endl;
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (Pistache::Http::HttpError &e) {
......@@ -160,6 +169,7 @@ void DefaultApi::ue_authentications_post_handler(const Pistache::Rest::Request &
return;
} catch (std::exception &e) {
//send a 500 error
cout << "**500 error"<< endl;
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
......@@ -167,7 +177,7 @@ void DefaultApi::ue_authentications_post_handler(const Pistache::Rest::Request &
}
void DefaultApi::default_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
cout << "in default api handler" << endl;
cout << "--in default api handler" << endl;
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist-default");
}
......
......@@ -12,6 +12,10 @@
#include "DefaultApiImpl.h"
#include <iostream>
using namespace std;
namespace org {
namespace openapitools {
namespace server {
......@@ -30,12 +34,14 @@ void DefaultApiImpl::rg_authentications_post(const RgAuthenticationInfo &rgAuthe
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
void DefaultApiImpl::ue_authentications_auth_ctx_id5g_aka_confirmation_put(const std::string &authCtxId, const ConfirmationData &confirmationData, Pistache::Http::ResponseWriter &response) {
cout << "handling 5gaka confirmation -- put" << endl;
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
void DefaultApiImpl::ue_authentications_deregister_post(const DeregistrationInfo &deregistrationInfo, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
void DefaultApiImpl::ue_authentications_post(const AuthenticationInfo &authenticationInfo, Pistache::Http::ResponseWriter &response) {
cout << "handling 5gaka authentication -- post" << endl;
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
......
......@@ -27,6 +27,7 @@
#include "logger.hpp"
#include "options.hpp"
using namespace std;
......
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