File tree Expand file tree Collapse file tree
applications/accounts/scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,16 +8,18 @@ echo "Checking if API user exists..."
88
99# Check if user already exists
1010if /opt/keycloak/bin/kcadm.sh get users -q " username=$USERNAME " | grep -q " $USERNAME " ; then
11- echo " API user $USERNAME already exists, syncing password to the one in the secret"
12- /opt/keycloak/bin/kcadm.sh set-password --username " $USERNAME " --new-password " $PASSWORD "
11+ echo " ERROR: API user $USERNAME already exists, but password is out of sync. You may need to reset it manually."
12+ # /opt/keycloak/bin/kcadm.sh set-password --username "$USERNAME" --new-password "$PASSWORD"
13+ # Removed automatic password reset as that would only work if the main admin password is unchanged from the default password
14+ # That would create the false impression that the password is reset successfully when in fact it has not on production systems
1315 exit 0
1416fi
1517
1618echo " Creating API user $USERNAME "
17-
19+ set -e
1820# create the user and reload keycloak
1921/opt/keycloak/bin/kcadm.sh create users -s " username=$USERNAME " -s enabled=True
20-
22+ /opt/keycloak/bin/kcadm.sh set-password --username " $USERNAME " --new-password " $PASSWORD "
2123/opt/keycloak/bin/kcadm.sh add-roles --uusername " $USERNAME " --rolename admin
2224
2325echo " API user created successfully"
You can’t perform that action at this time.
0 commit comments