From c39e95c7cb1ad6e812aa3ce4000b4dfdf214e77e Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Wed, 15 Jul 2015 12:48:50 -0400 Subject: inital implementation of using GitLab OAuth2 provider for signup/login --- utils/config.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'utils/config.go') diff --git a/utils/config.go b/utils/config.go index e8fa9a477..163c912bf 100644 --- a/utils/config.go +++ b/utils/config.go @@ -32,6 +32,13 @@ type ServiceSettings struct { StorageDirectory string } +type SSOSettings struct { + AllowGitLabSSO bool + GitLabSecret string + GitLabId string + GitLabUrl string +} + type SqlSettings struct { DriverName string DataSource string @@ -109,6 +116,7 @@ type Config struct { EmailSettings EmailSettings PrivacySettings PrivacySettings TeamSettings TeamSettings + SSOSettings SSOSettings } func (o *Config) ToJson() string { -- cgit v1.2.3-1-g7c22 From 03528b9619747b8bd184b852497dcf14ee1e0081 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Fri, 17 Jul 2015 09:47:25 -0400 Subject: made oauth architecture more generalized --- utils/config.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'utils/config.go') diff --git a/utils/config.go b/utils/config.go index 163c912bf..b90337b7e 100644 --- a/utils/config.go +++ b/utils/config.go @@ -32,11 +32,13 @@ type ServiceSettings struct { StorageDirectory string } -type SSOSettings struct { - AllowGitLabSSO bool - GitLabSecret string - GitLabId string - GitLabUrl string +type SSOSetting struct { + Allow bool + Secret string + Id string + AuthEndpoint string + TokenEndpoint string + UserApiEndpoint string } type SqlSettings struct { @@ -116,7 +118,7 @@ type Config struct { EmailSettings EmailSettings PrivacySettings PrivacySettings TeamSettings TeamSettings - SSOSettings SSOSettings + SSOSettings map[string]SSOSetting } func (o *Config) ToJson() string { -- cgit v1.2.3-1-g7c22 From 56a0a7d1e1fbd9405559a9c6e32962155d9cc562 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Wed, 22 Jul 2015 15:32:39 -0400 Subject: only show gitlab signup/login links if gitlab oauth is turned on --- utils/config.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'utils/config.go') diff --git a/utils/config.go b/utils/config.go index b90337b7e..6a428a5c1 100644 --- a/utils/config.go +++ b/utils/config.go @@ -253,3 +253,14 @@ func IsS3Configured() bool { return true } + +func GetAllowedAuthServices() []string { + authServices := []string{} + for name, service := range Cfg.SSOSettings { + if service.Allow { + authServices = append(authServices, name) + } + } + + return authServices +} -- cgit v1.2.3-1-g7c22