Skip to content

Commit

Permalink
https://telecominfraproject.atlassian.net/browse/WIFI-12068
Browse files Browse the repository at this point in the history
Signed-off-by: stephb9959 <[email protected]>
  • Loading branch information
stephb9959 committed Jan 31, 2023
1 parent 4bbc415 commit 8fff2ce
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
17 changes: 17 additions & 0 deletions openpapi/owsec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1988,12 +1988,29 @@ paths:
schema:
type: boolean
required: false
- in: query
name: dictionary
schema:
type: boolean
required: false
responses:
200:
description: Successfull retrieval
content:
application/json:
schema:
oneOf:
- type: object
properties:
knownKeys:
type: array
items:
type: object
properties:
key:
type: string
helper:
type: string
- $ref: '#/components/schemas/SystemSecretEntry'
- $ref: '#/components/schemas/SystemSecretEntryList'
403:
Expand Down
21 changes: 21 additions & 0 deletions src/RESTAPI/RESTAPI_systemSecret_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,27 @@ namespace OpenWifi {
return ReturnObject(List);
}

if(GetBoolParameter("dictionary")) {
static std::vector<std::pair<std::string,std::string>> KnownKeys =
{
{ "google.maps.apikey" , "A Google Key specific for the Google MAPS API."},
{ "iptocountry.ipinfo.token", "IPInfo.io service token."},
{ "iptocountry.ipdata.apikey", "IPData.co API Key."},
{ "iptocountry.ip2location.apikey", "IP2Location.com API Key"}
};

Poco::JSON::Object Answer;
Poco::JSON::Array Entries;
for(const auto &[key,description]:KnownKeys) {
Poco::JSON::Object E;
E.set("key",key);
E.set("description",description);
Entries.add(E);
}
Answer.set("knownKeys", Entries);
return ReturnObject(Answer);
}

auto Key = GetBinding("secret");
if(Key.empty()) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
Expand Down
8 changes: 8 additions & 0 deletions test_scripts/curl/cli
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,14 @@ getsecret() {
jq < ${result_file}
}

getsecretdictionary() {
curl ${FLAGS} -X GET "https://${OWSEC}/api/v1/systemSecret/0?dictionary=true" \
-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" \
Expand Down

0 comments on commit 8fff2ce

Please sign in to comment.