summaryrefslogtreecommitdiff
path: root/auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'auth.go')
-rw-r--r--auth.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/auth.go b/auth.go
index 0151380..94567f2 100644
--- a/auth.go
+++ b/auth.go
@@ -205,12 +205,17 @@ func handleAuth(w http.ResponseWriter, req *http.Request) {
return
}
+ now := time.Now()
+ expr := now.Add(time.Duration(config.Auth.Expr) * time.Second)
+ exprU := expr.Unix()
+
cookie := http.Cookie{
Name: "session",
Value: cookieValue,
SameSite: http.SameSiteLaxMode,
HttpOnly: true,
Secure: config.Prod,
+ Expires: expr,
/*
* TODO: Cookies should also have an expiration; cookies
* without expiration don't even persist across browser
@@ -228,7 +233,7 @@ func handleAuth(w http.ResponseWriter, req *http.Request) {
claims.Email,
department,
cookieValue,
- 1881839332, /* TODO */
+ exprU,
)
if err != nil {
var pgErr *pgconn.PgError
@@ -240,7 +245,7 @@ func handleAuth(w http.ResponseWriter, req *http.Request) {
claims.Email,
department,
cookieValue,
- 1881839332, /* TODO */
+ exprU,
claims.Oid,
)
if err != nil {