api: allow authentication when on http

This commit is contained in:
yusing 2025-03-28 07:18:50 +08:00
parent 78a3c8a8e4
commit 480fb4818c
2 changed files with 2 additions and 3 deletions

View file

@ -162,7 +162,7 @@ func (auth *OIDCProvider) RedirectLoginPage(w http.ResponseWriter, r *http.Reque
MaxAge: 300, MaxAge: 300,
HttpOnly: true, HttpOnly: true,
SameSite: http.SameSiteLaxMode, SameSite: http.SameSiteLaxMode,
Secure: true, Secure: r.TLS != nil,
Path: "/", Path: "/",
}) })

View file

@ -43,7 +43,7 @@ func setTokenCookie(w http.ResponseWriter, r *http.Request, name, value string,
MaxAge: int(ttl.Seconds()), MaxAge: int(ttl.Seconds()),
Domain: cookieFQDN(r), Domain: cookieFQDN(r),
HttpOnly: true, HttpOnly: true,
Secure: true, Secure: r.TLS != nil,
SameSite: http.SameSiteLaxMode, SameSite: http.SameSiteLaxMode,
Path: "/", Path: "/",
}) })
@ -56,7 +56,6 @@ func clearTokenCookie(w http.ResponseWriter, r *http.Request, name string) {
MaxAge: -1, MaxAge: -1,
Domain: cookieFQDN(r), Domain: cookieFQDN(r),
HttpOnly: true, HttpOnly: true,
Secure: true,
SameSite: http.SameSiteLaxMode, SameSite: http.SameSiteLaxMode,
Path: "/", Path: "/",
}) })