Skip to content

Commit

Permalink
https://telecominfraproject.atlassian.net/browse/WIFI-7831
Browse files Browse the repository at this point in the history
Signed-off-by: stephb9959 <[email protected]>
  • Loading branch information
stephb9959 committed Sep 12, 2023
1 parent 5390d1f commit 797a7f2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/RESTAPI/RESTAPI_openroaming_gr_acct_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace OpenWifi {

void RESTAPI_openroaming_gr_acct_handler::DoGet() {
auto Account = GetBinding("account","");
auto Account = GetBinding("id","");
if(Account.empty()) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
Expand All @@ -21,7 +21,7 @@ namespace OpenWifi {
}

void RESTAPI_openroaming_gr_acct_handler::DoDelete() {
auto Account = GetBinding("account","");
auto Account = GetBinding("id","");
if(Account.empty()) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
Expand All @@ -38,7 +38,7 @@ namespace OpenWifi {
}

void RESTAPI_openroaming_gr_acct_handler::DoPost() {
auto Account = GetBinding("account","");
auto Account = GetBinding("id","");
if(Account.empty()) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
Expand Down Expand Up @@ -78,6 +78,10 @@ namespace OpenWifi {
return BadRequest(RESTAPI::Errors::CannotCreateCSR);
}

NewObject.CSR = R.CSR;
NewObject.CSRPublicKey = R.PublicKey;
NewObject.CSRPrivateKey = R.PrivateKey;

ProvObjects::CreateObjectInfo(RawObject,UserInfo_.userinfo,NewObject.info);

if(DB_.CreateRecord(NewObject)) {
Expand Down
13 changes: 13 additions & 0 deletions test_scripts/curl/cli
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,18 @@ getsystemconfiguration() {
jq < ${result_file}
}

creategraccount() {
payload="{ \"name\" : \"Test account\" , \"country\" : \"CA\", \"province\" : \"BC\" , \"city\" : \"Vancouver\", \"organization\" : \"Arilia Wireless Inc.\", \"commonName\" : \"arilia.com\", \"GlobalReachAcctId\" : \"bd63aaa7-b14d-4cdb-85ae-8de6cf2cfa31\", \"privateKey\" : \"-----BEGIN PRIVATE KEY-----MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgl1FpARtuOtw1F9sR2DD82jh6sZFGRn619IY0rmNIFEuhRANCAATB7ji6OF/+heGRCocgVNhw4QGvaL9Kp8F6ZqqZ3aMewRMOfzi3TQaXN12FNBsvXnptx5vk8GAzZk6UAzzvMBVK-----END PRIVATE KEY-----\" }"
echo $payload | jq

curl ${FLAGS} -X POST "https://${OWPROV}/api/v1/openroaming/globalreach/account/0" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${token}" \
-H "Accept: application/json" \
-d "$payload" > ${result_file}
jq < ${result_file}
}

shopt -s nocasematch
case "$1" in
"login") login; echo "You are logged in..." ; logout ;;
Expand Down Expand Up @@ -673,6 +685,7 @@ case "$1" in
"deleteoverride") login; deleteoverride "$2"; logout;;
"venueupgraderevisions") login; venueupgraderevisions "$2"; logout;;
"getsystemconfiguration") login; getsystemconfiguration "$2"; logout;;
"creategraccount") login; creategraccount ; logout;;
"getvenuesperrrm") login; getvenuesperrrm "$2"; logout;;
*) help ;;
esac
Expand Down

0 comments on commit 797a7f2

Please sign in to comment.