Pass in the original email address too as X-Forwarded-Email.
This commit is contained in:
parent
cfad6acf8f
commit
ec9c11ed28
@ -272,6 +272,7 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
|||||||
|
|
||||||
var ok bool
|
var ok bool
|
||||||
var user string
|
var user string
|
||||||
|
var email string
|
||||||
|
|
||||||
if req.URL.Path == pingPath {
|
if req.URL.Path == pingPath {
|
||||||
p.PingPage(rw)
|
p.PingPage(rw)
|
||||||
@ -343,7 +344,6 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
cookie, err := req.Cookie(p.CookieKey)
|
cookie, err := req.Cookie(p.CookieKey)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
var email string
|
|
||||||
email, ok = validateCookie(cookie, p.CookieSeed)
|
email, ok = validateCookie(cookie, p.CookieSeed)
|
||||||
user = strings.Split(email, "@")[0]
|
user = strings.Split(email, "@")[0]
|
||||||
}
|
}
|
||||||
@ -368,6 +368,7 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
|||||||
if *passBasicAuth {
|
if *passBasicAuth {
|
||||||
req.SetBasicAuth(user, "")
|
req.SetBasicAuth(user, "")
|
||||||
req.Header["X-Forwarded-User"] = []string{user}
|
req.Header["X-Forwarded-User"] = []string{user}
|
||||||
|
req.Header["X-Forwarded-Email"] = []string{email}
|
||||||
}
|
}
|
||||||
|
|
||||||
p.serveMux.ServeHTTP(rw, req)
|
p.serveMux.ServeHTTP(rw, req)
|
||||||
|
Loading…
Reference in New Issue
Block a user