FIX: Discourse groups now are in CSV format instead of an array
This commit is contained in:
parent
017810a752
commit
15ab750172
4
main.go
4
main.go
|
@ -180,6 +180,8 @@ func redirectIfNoCookie(handler http.Handler, r *http.Request, w http.ResponseWr
|
||||||
admin := parsedQuery["admin"]
|
admin := parsedQuery["admin"]
|
||||||
nonce := parsedQuery["nonce"]
|
nonce := parsedQuery["nonce"]
|
||||||
|
|
||||||
|
groupsArray := strings.Split(groups[0], ",")
|
||||||
|
|
||||||
if len(nonce) > 0 && len(admin) > 0 && len(username) > 0 && (admin[0] == "true" || *config.AllowAllPtr) {
|
if len(nonce) > 0 && len(admin) > 0 && len(username) > 0 && (admin[0] == "true" || *config.AllowAllPtr) {
|
||||||
returnUrl, err := getReturnUrl(*config.SsoSecretPtr, sso, sig, nonce[0])
|
returnUrl, err := getReturnUrl(*config.SsoSecretPtr, sso, sig, nonce[0])
|
||||||
|
|
||||||
|
@ -191,7 +193,7 @@ func redirectIfNoCookie(handler http.Handler, r *http.Request, w http.ResponseWr
|
||||||
// we have a valid auth
|
// we have a valid auth
|
||||||
expiration := time.Now().Add(365 * 24 * time.Hour)
|
expiration := time.Now().Add(365 * 24 * time.Hour)
|
||||||
|
|
||||||
cookieData := strings.Join([]string{username[0], strings.Join(groups, "|")}, ",")
|
cookieData := strings.Join([]string{username[0], strings.Join(groupsArray, "|")}, ",")
|
||||||
cookie := http.Cookie{Name: "__discourse_proxy", Value: signCookie(cookieData, config.CookieSecret), Expires: expiration, HttpOnly: true}
|
cookie := http.Cookie{Name: "__discourse_proxy", Value: signCookie(cookieData, config.CookieSecret), Expires: expiration, HttpOnly: true}
|
||||||
http.SetCookie(w, &cookie)
|
http.SetCookie(w, &cookie)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue