Adding signup process.

This commit is contained in:
stephb9959
2022-02-20 15:13:12 -08:00
parent 9e22cdebfe
commit ae002af9bf
6 changed files with 83 additions and 2 deletions

View File

@@ -90,7 +90,7 @@ add_executable(owsub
src/RESTAPI/RESTAPI_wifiClients_handler.cpp src/RESTAPI/RESTAPI_wifiClients_handler.h
src/RESTObjects/RESTAPI_SubObjects.cpp src/RESTObjects/RESTAPI_SubObjects.h
src/RESTAPI/RESTAPI_subscriber_handler.cpp src/RESTAPI/RESTAPI_subscriber_handler.h
src/RESTAPI/RESTAPI_oauth2_handler.cpp src/RESTAPI/RESTAPI_oauth2_handler.h src/RESTAPI/RESTAPI_action_handler.cpp src/RESTAPI/RESTAPI_action_handler.h src/RESTAPI/RESTAPI_mfa_handler.cpp src/RESTAPI/RESTAPI_mfa_handler.h src/sdks/SDK_prov.cpp src/sdks/SDK_prov.h src/sdks/SDK_gw.cpp src/sdks/SDK_gw.h src/sdks/SDK_sec.cpp src/sdks/SDK_sec.h src/RESTAPI/RESTAPI_claim_handler.cpp src/RESTAPI/RESTAPI_claim_handler.h)
src/RESTAPI/RESTAPI_oauth2_handler.cpp src/RESTAPI/RESTAPI_oauth2_handler.h src/RESTAPI/RESTAPI_action_handler.cpp src/RESTAPI/RESTAPI_action_handler.h src/RESTAPI/RESTAPI_mfa_handler.cpp src/RESTAPI/RESTAPI_mfa_handler.h src/sdks/SDK_prov.cpp src/sdks/SDK_prov.h src/sdks/SDK_gw.cpp src/sdks/SDK_gw.h src/sdks/SDK_sec.cpp src/sdks/SDK_sec.h src/RESTAPI/RESTAPI_claim_handler.cpp src/RESTAPI/RESTAPI_claim_handler.h src/RESTAPI/RESTAPI_signup_handler.cpp src/RESTAPI/RESTAPI_signup_handler.h)
target_link_libraries(owsub PUBLIC
${Poco_LIBRARIES} ${MySQL_LIBRARIES}

2
build
View File

@@ -1 +1 @@
3
6

View File

@@ -1085,3 +1085,30 @@ paths:
type: string
details:
type: string
/signup:
post:
tags:
- Subscriber Registration
summary: This call allows a new subscriber to register themselves and their devices.
operationId: postSignup
parameters:
- in: query
name: email
schema:
type: string
format: email
required: true
- in: query
name: serialNumber
schema:
type: string
required: true
responses:
200:
$ref: '#/components/responses/Success'
400:
$ref: '#/components/responses/BadRequest'
404:
$ref: '#/components/responses/Unauthorized'

View File

@@ -10,6 +10,7 @@
#include "RESTAPI/RESTAPI_action_handler.h"
#include "RESTAPI/RESTAPI_mfa_handler.h"
#include "RESTAPI/RESTAPI_claim_handler.h"
#include "RESTAPI/RESTAPI_signup_handler.h"
namespace OpenWifi {
@@ -23,6 +24,7 @@ namespace OpenWifi {
RESTAPI_action_handler,
RESTAPI_mfa_handler,
RESTAPI_claim_handler,
RESTAPI_signup_handler,
RESTAPI_system_command>(Path, Bindings, L, S, TransactionId);
}

View File

@@ -0,0 +1,14 @@
//
// Created by stephane bourque on 2022-02-20.
//
#include "RESTAPI_signup_handler.h"
#include "framework/API_Proxy.h"
namespace OpenWifi {
void RESTAPI_signup_handler::DoPost() {
API_Proxy(Logger_, Request, Response, OpenWifi::uSERVICE_SECURITY.c_str(),"/api/v1/signup");
}
}

View File

@@ -0,0 +1,38 @@
//
// Created by stephane bourque on 2022-02-20.
//
#pragma once
#include "framework/MicroService.h"
namespace OpenWifi {
class RESTAPI_signup_handler : public RESTAPIHandler {
public:
RESTAPI_signup_handler(const RESTAPIHandler::BindingMap &bindings, Poco::Logger &L, RESTAPI_GenericServer & Server, uint64_t TransactionId, bool Internal)
: RESTAPIHandler(bindings, L,
std::vector<std::string>{
Poco::Net::HTTPRequest::HTTP_POST,
Poco::Net::HTTPRequest::HTTP_OPTIONS},
Server,
TransactionId,
Internal, false, true ){}
static const std::list<const char *> PathName() { return std::list<const char *>{"/api/v1/action"}; };
/* inline bool RoleIsAuthorized(std::string & Reason) {
if(UserInfo_.userinfo.userRole != SecurityObjects::USER_ROLE::SUBSCRIBER) {
Reason = "User must be a subscriber";
return false;
}
return true;
}
*/
void DoGet() final {};
void DoPost() final;
void DoPut() final {};
void DoDelete() final {};
private:
};
}