git.iko.soy/typeable/oauth2-proxy
on master help sign in
Merge pull request #35 from rogerhu/email

Pass in the original email address too as X-Forwarded-Email.

commit2f165345a858a64e2ac9f3fc714d82b549d23923 authorJehiah Czebotar <jehiah@gmail.com> dateSat 8 Nov 2014, 19:11 (12 years ago) parentcfad6acec9c11e
1 file changed+2−1
oauthproxy.go+2−1
oauthproxy.go+2−1
@@ -272,6 +272,7 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
272272
273273 var ok bool
274274 var user string
275+ var email string
275276
276277 if req.URL.Path == pingPath {
277278 p.PingPage(rw)
@@ -343,7 +344,6 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
343344 if !ok {
344345 cookie, err := req.Cookie(p.CookieKey)
345346 if err == nil {
346− var email string
347347 email, ok = validateCookie(cookie, p.CookieSeed)
348348 user = strings.Split(email, "@")[0]
349349 }
@@ -368,6 +368,7 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
368368 if *passBasicAuth {
369369 req.SetBasicAuth(user, "")
370370 req.Header["X-Forwarded-User"] = []string{user}
371+ req.Header["X-Forwarded-Email"] = []string{email}
371372 }
372373
373374 p.serveMux.ServeHTTP(rw, req)