migrate LDAP users to OIDC

This commit is contained in:
Vladimir D
2024-02-15 15:50:03 +04:00
parent 25292a86b4
commit e556c856f1
4 changed files with 56 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ sed -e "s/DB_HOST=.*/DB_HOST=${CLOUDRON_POSTGRESQL_HOST}/g" \
-e "s/WEB_DOMAIN=.*/WEB_DOMAIN=${CLOUDRON_APP_DOMAIN}/g" \
-i /app/data/env.production
# migrate LDAP settings to OIDC
# migrate LDAP settings to OIDC (should be removed on the next release)
if grep -q "^LDAP_ENABLED" /app/data/env.production; then
# get rid LDAP settings
sed -e "s/LDAP_.*//g" \
@@ -48,11 +48,15 @@ OIDC_REDIRECT_URI=
OIDC_DISCOVERY=
OIDC_SCOPE=
OIDC_UID_FIELD=
OIDC_SECURITY_ASSUME_EMAIL_IS_VERIFIED=
EOT
fi
if [[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]]; then
# should be removed on the next release
echo "==> migrating LDAP users to OIDC"
/app/pkg/migrateUsers.js
echo "==> Setting up OIDC"
sed -e "s/OIDC_ENABLED=.*/OIDC_ENABLED=true/g" \
-e "s/OIDC_DISPLAY_NAME=.*/OIDC_DISPLAY_NAME=Cloudron/g" \
@@ -63,6 +67,7 @@ if [[ -n "${CLOUDRON_OIDC_ISSUER:-}" ]]; then
-e "s/OIDC_DISCOVERY=.*/OIDC_DISCOVERY=true/g" \
-e "s/OIDC_SCOPE=.*/OIDC_SCOPE=openid,profile,email/g" \
-e "s/OIDC_UID_FIELD=.*/OIDC_UID_FIELD=sub/g" \
-e "s/OIDC_SECURITY_ASSUME_EMAIL_IS_VERIFIED=.*/OIDC_SECURITY_ASSUME_EMAIL_IS_VERIFIED=true/g" \
-i /app/data/env.production
fi