Skip to content

Commit bff42a6

Browse files
committed
CH-231 remove auto api user password update
1 parent 2057295 commit bff42a6

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

applications/accounts/scripts/create_api_user.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@ echo "Checking if API user exists..."
88

99
# Check if user already exists
1010
if /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
1416
fi
1517

1618
echo "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

2325
echo "API user created successfully"

0 commit comments

Comments
 (0)