From 6d41701bab5f8996c294809b488a32b5f464f0dd Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 23 Jun 2015 10:15:46 -0700 Subject: [PATCH] oauth integration --- CloudronManifest.json | 3 ++- app.ini.template | 12 ++++++++++++ start.sh | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CloudronManifest.json b/CloudronManifest.json index f3e9eb6..49f01bd 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -10,7 +10,8 @@ "addons": { "mysql": { }, "sendmail": { }, - "localstorage": { } + "localstorage": { }, + "oauth": { } }, "tcpPorts": { "SSH_PORT": { diff --git a/app.ini.template b/app.ini.template index e329f95..e8f8e99 100644 --- a/app.ini.template +++ b/app.ini.template @@ -42,3 +42,15 @@ SECRET_KEY = ##SECRET_KEY DISABLE_REGISTRATION = false SHOW_REGISTRATION_BUTTON = false +[oauth] +ENABLED = true + +[oauth.cloudron] +ENABLED = true +CLIENT_ID = ##OAUTH_CLIENT_ID +CLIENT_SECRET = ##OAUTH_CLIENT_SECRET +SCOPES = root,profile,apps,roleAdmin,user +AUTH_URL = ##OAUTH_AUTH_URL +TOKEN_URL = ##OAUTH_TOKEN_URL +CLOUDRON_ORIGIN = ##OAUTH_CLOUDRON_ORIGIN + diff --git a/start.sh b/start.sh index 62755ed..14e1aa0 100755 --- a/start.sh +++ b/start.sh @@ -55,6 +55,11 @@ sed -e "s/##HOSTNAME/${fqdn}/g" \ -e "s/##MAIL_PORT/${MAIL_SMTP_PORT}/g" \ -e "s/##MAIL_FROM/${MAIL_SMTP_USERNAME}@${MAIL_DOMAIN}/g" \ -e "s/##SECRET_KEY/$(pwgen -1 -s)/g" \ + -e "s/##OAUTH_CLIENT_ID/${OAUTH_CLIENT_ID}/g" \ + -e "s/##OAUTH_CLIENT_SECRET/${OAUTH_CLIENT_SECRET}/g" \ + -e "s,##OAUTH_AUTH_URL,${ADMIN_ORIGIN}/api/v1/oauth/dialog/authorize,g" \ + -e "s,##OAUTH_TOKEN_URL,${ADMIN_ORIGIN}/api/v1/oauth/token,g" \ + -e "s,##CLOUDRON_ORIGIN,${ADMIN_ORIGIN},g" \ /home/cloudron/app.ini.template > "/home/cloudron/gogs/custom/conf/app.ini" supervisorctl restart gogs