summaryrefslogtreecommitdiffstats
path: root/api/user.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-08-13 12:03:47 -0400
committerJoramWilander <jwawilander@gmail.com>2015-08-14 12:37:08 -0400
commite27db2ed63fd3c9c686c049a9b9049a907985ecc (patch)
tree701fcc97846e658e34c5d7ffada5b1d51a4920a9 /api/user.go
parentb9aef9f2a6b90663cb7ba4ff9e42560c145b631d (diff)
downloadchat-e27db2ed63fd3c9c686c049a9b9049a907985ecc.tar.gz
chat-e27db2ed63fd3c9c686c049a9b9049a907985ecc.tar.bz2
chat-e27db2ed63fd3c9c686c049a9b9049a907985ecc.zip
initial server implementation for using google as a single-sign-on oauth service
Diffstat (limited to 'api/user.go')
-rw-r--r--api/user.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/api/user.go b/api/user.go
index a42f81cf1..79f2201da 100644
--- a/api/user.go
+++ b/api/user.go
@@ -1314,9 +1314,15 @@ func GetAuthorizationCode(c *Context, w http.ResponseWriter, r *http.Request, te
clientId := utils.Cfg.SSOSettings[service].Id
endpoint := utils.Cfg.SSOSettings[service].AuthEndpoint
+ scope := utils.Cfg.SSOSettings[service].Scope
state := model.HashPassword(clientId)
authUrl := endpoint + "?response_type=code&client_id=" + clientId + "&redirect_uri=" + url.QueryEscape(redirectUri+"?team="+teamName) + "&state=" + url.QueryEscape(state)
+
+ if len(scope) > 0 {
+ authUrl += "&scope=" + utils.UrlEncode(scope)
+ }
+
http.Redirect(w, r, authUrl, http.StatusFound)
}