docker-compose environment for the entire v.st system https://v.st/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
env/keycloak/client-create

35 lines
854 B

#!/bin/bash
die() { echo >&2 "$@" ; exit 1 ; }
client_name="$1"
hostname="$2"
secret="$3"
client_id="$(client-get $client_name)"
if [ -n "$client_id" ]; then
#kcadm.sh delete "clients/$client_id" -r "$REALM" || die "$client_id: unable to delete"
echo >&2 "$client_name: $client_id already exists"
echo "$client_id"
exit 0
fi
# remember to add a leading , if adding extra data
extra="$(cat -)"
kcadm.sh create clients -r "$REALM" -f - <<EOF || die "$client_name: unable to create"
{
"clientId": "$client_name",
"rootUrl": "https://$hostname",
"adminUrl": "https://$hostname",
"redirectUris": [ "https://$hostname/*" ],
"webOrigins": [ "https://$hostname" ],
"clientAuthenticatorType": "client-secret",
"secret": "$secret"
$extra
}
EOF
client_id=$(client-get "$client_name")
echo >&2 "$client_name: $client_id created"
echo "$client_id"