git.iko.soy/typeable/oauth2-proxy
on master help sign in
more robust ClearSessionCookie()
74d0fbcPierce Lopez
oauthproxy.go+9−1
@@ -300,7 +300,15 @@ func (p *OAuthProxy) SetCSRFCookie(rw http.ResponseWriter, req *http.Request, va
300}
300}
301
301
302func (p *OAuthProxy) ClearSessionCookie(rw http.ResponseWriter, req *http.Request) {
302func (p *OAuthProxy) ClearSessionCookie(rw http.ResponseWriter, req *http.Request) {
303− http.SetCookie(rw, p.MakeSessionCookie(req, "", time.Hour*-1, time.Now()))
303+ clr := p.MakeSessionCookie(req, "", time.Hour*-1, time.Now())
304+ http.SetCookie(rw, clr)
305+
306+ // ugly hack because default domain changed
307+ if p.CookieDomain == "" {
308+ clr2 := *clr
309+ clr2.Domain = req.Host
310+ http.SetCookie(rw, &clr2)
311+ }
304}
312}
305
313
306func (p *OAuthProxy) SetSessionCookie(rw http.ResponseWriter, req *http.Request, val string) {
314func (p *OAuthProxy) SetSessionCookie(rw http.ResponseWriter, req *http.Request, val string) {