From ec9c11ed280bba162ab543759301e80f8ddeae66 Mon Sep 17 00:00:00 2001 From: Roger Hu Date: Sat, 8 Nov 2014 07:49:05 +0000 Subject: [PATCH] Pass in the original email address too as X-Forwarded-Email. --- oauthproxy.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oauthproxy.go b/oauthproxy.go index 87a29b2..e7f65a6 100644 --- a/oauthproxy.go +++ b/oauthproxy.go @@ -272,6 +272,7 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) { var ok bool var user string + var email string if req.URL.Path == pingPath { p.PingPage(rw) @@ -343,7 +344,6 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) { if !ok { cookie, err := req.Cookie(p.CookieKey) if err == nil { - var email string email, ok = validateCookie(cookie, p.CookieSeed) user = strings.Split(email, "@")[0] } @@ -368,6 +368,7 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) { if *passBasicAuth { req.SetBasicAuth(user, "") req.Header["X-Forwarded-User"] = []string{user} + req.Header["X-Forwarded-Email"] = []string{email} } p.serveMux.ServeHTTP(rw, req)