mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-10 11:12:51 +01:00
switch to json
This commit is contained in:
@@ -28,7 +28,7 @@ function usage() {
|
|||||||
Optional parameters:
|
Optional parameters:
|
||||||
--role <role> (defaults to $DEFAULT_ROLE)
|
--role <role> (defaults to $DEFAULT_ROLE)
|
||||||
--note <note> (defaults to blank)
|
--note <note> (defaults to blank)
|
||||||
--raw only output generated secret
|
--json output as JSON
|
||||||
|
|
||||||
delete: Deletes a client from the oauth2 system
|
delete: Deletes a client from the oauth2 system
|
||||||
Required parameters:
|
Required parameters:
|
||||||
@@ -54,7 +54,7 @@ function usage() {
|
|||||||
Required parameters:
|
Required parameters:
|
||||||
--id <id>
|
--id <id>
|
||||||
Optional parameters:
|
Optional parameters:
|
||||||
--raw only output generated secret
|
--json output as JSON
|
||||||
|
|
||||||
USAGE_EOF
|
USAGE_EOF
|
||||||
exit 1
|
exit 1
|
||||||
@@ -87,8 +87,8 @@ while [[ $# -gt 0 ]]; do
|
|||||||
note=$1
|
note=$1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--raw)
|
--json)
|
||||||
raw=1
|
json=1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Encountered unexpected parameter: $param"
|
echo "Encountered unexpected parameter: $param"
|
||||||
@@ -326,10 +326,10 @@ case "${operation}" in
|
|||||||
|
|
||||||
lock
|
lock
|
||||||
createClient "$name" "${role:-$DEFAULT_ROLE}" "${note}"
|
createClient "$name" "${role:-$DEFAULT_ROLE}" "${note}"
|
||||||
if [[ "$raw" == "1" ]]; then
|
if [[ "$json" == "1" ]]; then
|
||||||
echo $secret
|
echo "{\"id\":\"$id\",\"secret\":\"$secret\"}"
|
||||||
else
|
else
|
||||||
echo "Successfully added user and generated secret: $secret"
|
echo "Successfully added user ID $id with generated secret: $secret"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -376,8 +376,8 @@ case "${operation}" in
|
|||||||
|
|
||||||
lock
|
lock
|
||||||
generateSecret "$id"
|
generateSecret "$id"
|
||||||
if [[ "$raw" == "1" ]]; then
|
if [[ "$json" == "1" ]]; then
|
||||||
echo $secret
|
echo "{\"secret\":\"$secret\"}"
|
||||||
else
|
else
|
||||||
echo "Successfully generated secret: $secret"
|
echo "Successfully generated secret: $secret"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ function manage_client() {
|
|||||||
name=$(echo "$request" | jq -r .name)
|
name=$(echo "$request" | jq -r .name)
|
||||||
note=$(echo "$request" | jq -r .note)
|
note=$(echo "$request" | jq -r .note)
|
||||||
log "Performing client '$op' for client with name '$name', note '$note' and role '$role'"
|
log "Performing client '$op' for client with name '$name', note '$note' and role '$role'"
|
||||||
response=$(so-client "$op" --name "$name" --note "$note" --role "$role" --raw)
|
response=$(so-client "$op" --name "$name" --note "$note" --role "$role" --json)
|
||||||
webResponse=$response
|
webResponse=$response
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
;;
|
;;
|
||||||
@@ -190,7 +190,7 @@ function manage_client() {
|
|||||||
generate-secret)
|
generate-secret)
|
||||||
client_id=$(echo "$request" | jq -r .id)
|
client_id=$(echo "$request" | jq -r .id)
|
||||||
log "Performing '$op' operation for client '$client_id'"
|
log "Performing '$op' operation for client '$client_id'"
|
||||||
response=$(so-client "$op" --id "$client_id" --raw)
|
response=$(so-client "$op" --id "$client_id" --json)
|
||||||
webResponse=$response
|
webResponse=$response
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in New Issue
Block a user