From ceff8ad91bc7e03b88abd620592150616827fff7 Mon Sep 17 00:00:00 2001 From: osmarks Date: Sun, 16 Jun 2024 14:14:54 +0100 Subject: [PATCH] Reverse proxy authentication --- user/net.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user/net.go b/user/net.go index a97503b..4558da3 100644 --- a/user/net.go +++ b/user/net.go @@ -25,11 +25,11 @@ func CanProceed(rq *http.Request, route string) bool { // FromRequest returns user from `rq`. If there is no user, an anon user is returned instead. func FromRequest(rq *http.Request) *User { - cookie, err := rq.Cookie("mycorrhiza_token") - if err != nil { + username, ok := rq.Header["X-Webauth-User"] + if !ok || len(username) < 1 { return EmptyUser() } - return ByToken(cookie.Value) + return ByName(username[0]) } // LogoutFromRequest logs the user in `rq` out and rewrites the cookie in `w`.