stephb9959
2023-01-30 20:48:16 -08:00
parent ffb7dd890e
commit 4bbc4154eb
4 changed files with 38 additions and 3 deletions

2
build
View File

@@ -1 +1 @@
11
12

View File

@@ -54,7 +54,6 @@ namespace OpenWifi {
SecretStore()->Remove(Key);
return OK();
}
void RESTAPI_systemSecret_handler::DoPut() {

View File

@@ -21,7 +21,7 @@ namespace OpenWifi {
Server,
TransactionId,
Internal) {}
static auto PathName() { return std::list<std::string>{"/systemSecret/{secret}"}; };
static auto PathName() { return std::list<std::string>{"/api/v1/systemSecret/{secret}"}; };
void DoGet() final;
void DoPost() final {};
void DoDelete() final;

View File

@@ -417,6 +417,38 @@ systeminfo() {
jq < ${result_file}
}
getsecret() {
curl ${FLAGS} -X GET "https://${OWSEC}/api/v1/systemSecret/${1}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${token}" > ${result_file}
jq < ${result_file}
}
getallsecrets() {
curl ${FLAGS} -X GET "https://${OWSEC}/api/v1/systemSecret/0?all=true" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${token}" > ${result_file}
jq < ${result_file}
}
setsecret() {
curl ${FLAGS} -X PUT "https://${OWSEC}/api/v1/systemSecret/${1}?value=${2}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${token}" > ${result_file}
jq < ${result_file}
}
deletesecret() {
curl ${FLAGS} -X DELETE "https://${OWSEC}/api/v1/systemSecret/${1}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${token}" > ${result_file}
jq < ${result_file}
}
reloadsubsystem() {
payload="{ \"command\" : \"reload\", \"subsystems\" : [ \"$1\" ] }"
curl ${FLAGS} -X POST "https://${OWSEC}/api/v1/system" \
@@ -578,6 +610,10 @@ case "$1" in
"createapikey") login; createapikey "$2" ; logout;;
"deleteapikey") login; deleteapikey "$2" "$3"; logout;;
"getapikey") login; getapikey "$2" ; logout;;
"getsecret") login; getsecret "$2" ; logout;;
"getallsecrets") login; getallsecrets ; logout;;
"setsecret") login; setsecret "$2" "$3" ; logout;;
"deletesecret") login; deletesecret "$2" ; logout;;
"help") login; help ; logout ;;
*) help ;;
esac