Skip to content

Commit e3ff3c6

Browse files
committed
common: use scheme variable and 127.0.0.1 for get_token
Use a scheme variable based on ENABLE_KEYCLOAK_HTTPS instead of hardcoding https. Use 127.0.0.1 instead of localhost to avoid curl resolving to IPv6 ::1, which kind does not bind on.
1 parent 74169de commit e3ff3c6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

.github/scripts/end2end/common.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
get_token() {
2+
if [[ "${ENABLE_KEYCLOAK_HTTPS}" == "true" ]]; then
3+
local scheme=https
4+
else
5+
local scheme=http
6+
fi
27
curl -k -H "Host: keycloak.zenko.local" \
38
-d "client_id=${OIDC_CLIENT_ID}" \
49
-d "username=${OIDC_USERNAME}" \
510
-d "password=${OIDC_PASSWORD}" \
611
-d "grant_type=password" \
712
-d "scope=openid" \
8-
https://localhost/auth/realms/${OIDC_REALM}/protocol/openid-connect/token | \
13+
${scheme}://127.0.0.1/auth/realms/${OIDC_REALM}/protocol/openid-connect/token | \
914
jq -cr '.id_token'
1015
}
1116

0 commit comments

Comments
 (0)