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