From e69f37f6fc5ad1dea2f639bc43276d1992d70d67 Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 1 Apr 2022 21:42:10 +0700 Subject: [PATCH] Cover the dex path /example case --- conf/.env | 6 +++--- scripts/backup | 3 +++ scripts/change_url | 3 +++ scripts/install | 15 +++++++++++++++ scripts/remove | 3 +++ scripts/restore | 3 +++ scripts/upgrade | 3 +++ 7 files changed, 33 insertions(+), 3 deletions(-) diff --git a/conf/.env b/conf/.env index c67d706..61cbf9e 100644 --- a/conf/.env +++ b/conf/.env @@ -77,9 +77,9 @@ AZURE_RESOURCE_APP_ID= # Redirect URI is https:///auth/oidc.callback OIDC_CLIENT_ID=__OIDC_NAME__ OIDC_CLIENT_SECRET=__OIDC_SECRET__ -OIDC_AUTH_URI=https://__DEX_DOMAIN____DEX_PATH__auth -OIDC_TOKEN_URI=https://__DEX_DOMAIN____DEX_PATH__token -OIDC_USERINFO_URI=https://__DEX_DOMAIN____DEX_PATH__userinfo +OIDC_AUTH_URI=__DEX_AUTH_URI__ +OIDC_TOKEN_URI=__DEX_TOKEN_URI__ +OIDC_USERINFO_URI=__DEX_USER_URI__ # Specify which claims to derive user information from # Supports any valid JSON path with the JWT payload diff --git a/scripts/backup b/scripts/backup index 55eeaa1..1ba5831 100755 --- a/scripts/backup +++ b/scripts/backup @@ -47,6 +47,9 @@ dex_path=$(ynh_app_setting_get --app=$dex_app --key=dex_path) oidc_secret=$(ynh_app_setting_get --app=$dex_app --key=oidc_secret) oidc_name=$(ynh_app_setting_get --app=$dex_app --key=oidc_name) oidc_callback=$(ynh_app_setting_get --app=$dex_app --key=oidc_callback) +dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) +dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) +dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/change_url b/scripts/change_url index 3d2364a..800b336 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -46,6 +46,9 @@ dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) +dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) +dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) +dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) #================================================= # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP diff --git a/scripts/install b/scripts/install index dd65fe8..30f7def 100755 --- a/scripts/install +++ b/scripts/install @@ -82,6 +82,18 @@ yunohost app install https://github.com/YunoHost-Apps/dex_ynh --force --args "do dex_app=$(gawk 'match($0, /Installation of (.+) completed/, app) {print app[1]}' dexlog.txt) rm dexlog.txt +# Create Dex URIs +if [ $i$dex_path -eq "/" ] +then + dex_auth_uri="https://$dex_domain/auth" + dex_token_uri="https://$dex_domain/token" + dex_user_uri="https://$dex_domain/userinfo" +else + dex_auth_uri="https://$dex_domain$dex_path/auth" + dex_token_uri="https://$dex_domain$dex_path/token" + dex_user_uri="https://$dex_domain$dex_path/userinfo" +fi + #=================================================== # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #=================================================== @@ -110,6 +122,9 @@ ynh_app_setting_set --app=$app --key=dex_path --value=$dex_path ynh_app_setting_set --app=$app --key=oidc_name --value=$oidc_name ynh_app_setting_set --app=$app --key=oidc_secret --value=$oidc_secret ynh_app_setting_set --app=$app --key=oidc_callback --value=$oidc_callback +ynh_app_setting_set --app=$app --key=dex_auth_uri --value=$dex_auth_uri +ynh_app_setting_set --app=$app --key=dex_token_uri --value=$dex_token_uri +ynh_app_setting_set --app=$app --key=dex_user_uri --value=$dex_user_uri #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/remove b/scripts/remove index 8cbddba..6943734 100755 --- a/scripts/remove +++ b/scripts/remove @@ -34,6 +34,9 @@ dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) +dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) +dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) +dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) #================================================= # STANDARD REMOVE diff --git a/scripts/restore b/scripts/restore index 48d68c3..5e5ace2 100755 --- a/scripts/restore +++ b/scripts/restore @@ -56,6 +56,9 @@ dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) +dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) +dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) +dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) #================================================= # CHECK IF THE APP CAN BE RESTORED diff --git a/scripts/upgrade b/scripts/upgrade index 391affb..5829e70 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -35,6 +35,9 @@ dex_path=$(ynh_app_setting_get --app=$app --key=dex_path) oidc_secret=$(ynh_app_setting_get --app=$app --key=oidc_secret) oidc_name=$(ynh_app_setting_get --app=$app --key=oidc_name) oidc_callback=$(ynh_app_setting_get --app=$app --key=oidc_callback) +dex_auth_uri=$(ynh_app_setting_get --app=$app --key=dex_auth_uri) +dex_token_uri=$(ynh_app_setting_get --app=$app --key=dex_token_uri) +dex_user_uri=$(ynh_app_setting_get --app=$app --key=dex_user_uri) #================================================= # CHECK VERSION