chore(easyauth) remove cookie

This commit is contained in:
kekskurse 2024-09-26 23:58:29 +02:00
parent ed070dddfa
commit 387b59789b

View file

@ -2,7 +2,6 @@ package auth
import (
"context"
"errors"
"fmt"
"net/http"
"time"
@ -112,29 +111,3 @@ func (e EasyAuth) AuthHTTPHandler(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, redirectUrlString, http.StatusTemporaryRedirect)
}
func getCookie(w http.ResponseWriter, r *http.Request, name string) (string, error) {
cookie, err := r.Cookie(name)
if err != nil {
if errors.Is(err, http.ErrNoCookie) {
return "", nil
}
return "", err
}
return cookie.Value, nil
}
func setCookie(w http.ResponseWriter, name, value string, expired time.Time) {
cookie := http.Cookie{}
cookie.Name = name
cookie.Value = value
cookie.Expires = expired
cookie.Path = "/"
cookie.MaxAge = int(time.Until(expired).Seconds())
cookie.Secure = true
cookie.HttpOnly = true
cookie.SameSite = http.SameSiteStrictMode
http.SetCookie(w, &cookie)
}