Skip to content

Commit 7175eb0

Browse files
committed
Make the OAuth2 client public in our Keycloak config (#3243)
Update the keycloak.sh to not create a private client. Instead of creating a private pbench-server-client, it now creates pbench-dashboard public client.
1 parent b0f3624 commit 7175eb0

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

server/pbenchinacan/load_keycloak.sh

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ADMIN_PASSWORD=${ADMIN_PASSWORD:-"admin"}
2424
# These values must match the options "realm" and "client in the
2525
# "openid-connect" section of the pbench server configuration file.
2626
REALM=${KEYCLOAK_REALM:-"pbench-server"}
27-
CLIENT=${KEYCLOAK_CLIENT:-"pbench-server-client"}
27+
CLIENT=${KEYCLOAK_CLIENT:-"pbench-dashboard"}
2828

2929
end_in_epoch_secs=$(date --date "2 minutes" +%s)
3030

@@ -68,8 +68,7 @@ fi
6868
CLIENT_CONF=$(curl -si -f -X POST "${KEYCLOAK_HOST_PORT}/admin/realms/${REALM}/clients" \
6969
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
7070
-H "Content-Type: application/json" \
71-
-d '{"clientId": "'${CLIENT}'", "directAccessGrantsEnabled": true, "serviceAccountsEnabled": true, "redirectUris": ["'${KEYCLOAK_REDIRECT_URI}'"]}')
72-
71+
-d '{"clientId": "'${CLIENT}'", "publicClient": true, "directAccessGrantsEnabled": true, "enabled": true, "redirectUris": ["'${KEYCLOAK_REDIRECT_URI}'"]}')
7372

7473
CLIENT_ID=$(grep -o -e 'http://[^[:space:]]*' <<< ${CLIENT_CONF} | sed -e 's|.*/||')
7574
if [[ -z "${CLIENT_ID}" ]]; then
@@ -79,14 +78,6 @@ else
7978
echo "Created ${CLIENT} client"
8079
fi
8180

82-
PBENCH_CLIENT_SECRET=$(curl -s -f -X POST "${KEYCLOAK_HOST_PORT}/admin/realms/${REALM}/clients/${CLIENT_ID}/client-secret" \
83-
-H "Authorization: Bearer ${ADMIN_TOKEN}" | jq -r '.value')
84-
85-
if [[ -z "${PBENCH_CLIENT_SECRET}" ]]; then
86-
echo "${CLIENT} secret is empty"
87-
exit 1
88-
fi
89-
9081
status_code=$(curl -s -o /dev/null -w "%{http_code}" -X POST "${KEYCLOAK_HOST_PORT}/admin/realms/${REALM}/clients/${CLIENT_ID}/roles" \
9182
-H "Authorization: Bearer ${ADMIN_TOKEN}" \
9283
-H "Content-Type: application/json" \

0 commit comments

Comments
 (0)