Commit 0bb32534 authored by Matthieu Lamalle's avatar Matthieu Lamalle

Migration to Gitlab

parent e6df2ed8
......@@ -6,19 +6,19 @@ function waitUrl()
local NB="${2:-30}"
#echo "waitUrl: $URL"
while [ "${NB}" -gt 0 ] ; do
if curl --output /tmp/curl --silent --head "$URL"
then
HTTPCODE=$(awk 'NR==1 { print $2; }' /tmp/curl)
else
HTTPCODE="-1"
fi
if [ "$HTTPCODE" = "200" ] || [ "$HTTPCODE" = "303" ] #|| [ "$HTTPCODE" = "404" ]
then
return 0
fi
sleep 1
NB=$(( NB - 1))
if curl --output /tmp/curl --silent --head "$URL"
then
HTTPCODE=$(awk 'NR==1 { print $2; }' /tmp/curl)
else
HTTPCODE="-1"
fi
if [ "$HTTPCODE" = "200" ] || [ "$HTTPCODE" = "303" ] #|| [ "$HTTPCODE" = "404" ]
then
return 0
fi
sleep 1
NB=$(( NB - 1))
done
cat /tmp/curl
return 1
......@@ -64,11 +64,11 @@ function createUser()
[ $? = 0 ] || die "Unable to create '$USERNAME' user"
$kcadm update users/$USER_UID/reset-password \
-r $realm \
-s type=password \
-s value="$PASSWORD" \
-s temporary=false \
-n
-r $realm \
-s type=password \
-s value="$PASSWORD" \
-s temporary=false \
-n
[ $? = 0 ] || die "Unable to set '$USERNAME' password"
echo "User '$USERNAME' created with UID=$USER_UID"
......@@ -79,11 +79,11 @@ function createUser()
# Group affectations
#########################################
$kcadm update users/$USER_UID/groups/$GROUP_ID \
-r $realm \
-s realm=$realm \
-s userId=$USER_UID \
-s groupId=$GROUP_ID \
-n
-r $realm \
-s realm=$realm \
-s userId=$USER_UID \
-s groupId=$GROUP_ID \
-n
[ $? = 0 ] || die "Unable to affect '$USER_UID' user to the '$GROUP_ID' group"
echo "$USERNAME user affected to the '$GROUP_ID' group."
fi
......@@ -109,8 +109,8 @@ $kcadm config credentials --server $KEYCLOAK_URL --realm master --user $KEYCLOAK
$kcadm get realms/$realm 1> /dev/null
if [ $? = 0 ]
then
echo "Realm '$realm' already exists. Abort configuration."
exit 0
echo "Realm '$realm' already exists. Abort configuration."
exit 0
fi
#########################################
......@@ -170,23 +170,20 @@ affectGroupToRole "$gidInstaller" "INSTALLER"
#########################################
USER_UID=""
createUser "$KC_REALM_USERNAME" "$KC_REALM_PASSWORD" "$gidAdmin"
createUser "yo" "yo" "$gidOperator"
createUser "test" "test" "$gidInstaller"
#########################################
# Create client(s)
#########################################
client_id=$($kcadm create clients \
-r $realm \
-s clientId=$KC_API_CLIENT_ID \
-s baseUrl=$SSO_END_POINT \
-s "redirectUris=[\"$SSO_END_POINT/*\",\"$SSO_END_POINT/*\"]" \
-s "webOrigins=[\"*\"]" \
-s publicClient=true \
-s directAccessGrantsEnabled=true \
-i)
-r $realm \
-s clientId=$KC_API_CLIENT_ID \
-s baseUrl=$SSO_END_POINT \
-s "redirectUris=[\"$SSO_END_POINT/*\",\"$SSO_END_POINT/*\"]" \
-s "webOrigins=[\"*\"]" \
-s publicClient=true \
-s directAccessGrantsEnabled=true \
-i)
[ $? = 0 ] || die "Unable to create client"
echo "Client '$client_id' created."
......@@ -205,9 +202,9 @@ $kcadm update authentication/flows/browser/executions -f /tmp/tmp.tok -r $realm
#########################################
echo "Get adapter configuration file..."
$kcadm get clients/$client_id/installation/providers/keycloak-oidc-keycloak-json \
-r $realm \
| jq ".[\"auth-server-url\"]=\"$SSO_END_POINT/auth\"" \
> $output/keycloak.json
-r $realm \
| jq ".[\"auth-server-url\"]=\"$SSO_END_POINT/auth\"" \
> $output/keycloak.json
[ $? = 0 ] || die "Unable to get configuration file"
cat $output/keycloak.json
cp $output/keycloak.json /tmp/zephir
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment