Spaces:
Running
Running
File size: 958 Bytes
b110593 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#!/bin/bash
set -eou pipefail
# Jump to root directory
cd "$( dirname "${BASH_SOURCE[0]}" )"/../.. || exit 1
function main() {
# Get admin token
TOKEN=$( curl --fail -s -X POST -d grant_type=password -d client_id=admin-cli -d username=admin -d password=admin http://localhost:9090/auth/realms/master/protocol/openid-connect/token | jq -r .access_token )
# Create user
if ! curl --fail -s -X POST -d '{"username":"johndoe", "enabled":true, "email":"[email protected]", "emailVerified":true, "credentials":[{"type":"password","value":"johndoe"}]}' -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' http://localhost:9090/auth/admin/realms/weaviate/users; then
echo Error creating user
return 1
fi
echo ""
echo "Created user 'johndoe' with password 'johndoe'."
echo "You can retrieve a token for this user using:"
echo " $ ./tools/dev/keycloak/get_token.sh johndoe"
echo ""
}
main "$@"
|