diff options
author | Unknown <joe2010xtmf@163.com> | 2014-04-13 18:12:07 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-04-13 18:12:07 -0400 |
commit | 4b9b8024ba59b5b84d92dca650761b35ebf6408a (patch) | |
tree | f40ed3d56e5df158168cb38a5f3b479c17903362 /modules/base/conf.go | |
parent | 8c266f2df5848b230c6fbb0bc4578a8907edc725 (diff) | |
download | gitea-4b9b8024ba59b5b84d92dca650761b35ebf6408a.tar.gz gitea-4b9b8024ba59b5b84d92dca650761b35ebf6408a.zip |
Clean oauth code
Diffstat (limited to 'modules/base/conf.go')
-rw-r--r-- | modules/base/conf.go | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go index d1564aa105..0eca5f4fcb 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -29,13 +29,17 @@ type Mailer struct { User, Passwd string } +type OauthInfo struct { + ClientId, ClientSecret string + Scopes string + AuthUrl, TokenUrl string +} + // Oauther represents oauth service. type Oauther struct { - GitHub struct { - Enabled bool - ClientId, ClientSecret string - Scopes string - } + GitHub, Google, Tencent bool + Twitter bool + OauthInfos map[string]*OauthInfo } var ( @@ -252,26 +256,6 @@ func newNotifyMailService() { log.Info("Notify Mail Service Enabled") } -func newOauthService() { - if !Cfg.MustBool("oauth", "ENABLED") { - return - } - - OauthService = &Oauther{} - oauths := make([]string, 0, 10) - - // GitHub. - if Cfg.MustBool("oauth.github", "ENABLED") { - OauthService.GitHub.Enabled = true - OauthService.GitHub.ClientId = Cfg.MustValue("oauth.github", "CLIENT_ID") - OauthService.GitHub.ClientSecret = Cfg.MustValue("oauth.github", "CLIENT_SECRET") - OauthService.GitHub.Scopes = Cfg.MustValue("oauth.github", "SCOPES") - oauths = append(oauths, "GitHub") - } - - log.Info("Oauth Service Enabled %s", oauths) -} - func NewConfigContext() { //var err error workDir, err := ExecDir() @@ -328,7 +312,7 @@ func NewConfigContext() { } } -func NewServices() { +func NewBaseServices() { newService() newLogService() newCacheService() @@ -336,5 +320,4 @@ func NewServices() { newMailService() newRegisterMailService() newNotifyMailService() - newOauthService() } |