Fix: cookie timeout
All checks were successful
All checks were successful
This commit is contained in:
@@ -3,6 +3,7 @@ package middlewares
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"gitea.konchin.com/go2025/backend/interfaces"
|
||||
"gitea.konchin.com/go2025/backend/models"
|
||||
@@ -46,10 +47,12 @@ func refreshAccessToken(
|
||||
}
|
||||
|
||||
http.SetCookie(w, &http.Cookie{
|
||||
Name: "access_token",
|
||||
Value: ret,
|
||||
Path: "/",
|
||||
Secure: false,
|
||||
Name: "access_token",
|
||||
Value: ret,
|
||||
Path: "/",
|
||||
Secure: viper.GetBool("https"),
|
||||
Expires: time.Now().Add(time.Duration(
|
||||
viper.GetInt64("access-token-timeout")) * time.Second),
|
||||
HttpOnly: true,
|
||||
SameSite: http.SameSiteLaxMode,
|
||||
})
|
||||
|
||||
@@ -62,7 +62,8 @@ func (self *Handlers) CheckRefreshToken(
|
||||
Name: "refresh_token",
|
||||
Value: session.RefreshToken,
|
||||
Path: "/",
|
||||
Secure: false,
|
||||
Secure: viper.GetBool("https"),
|
||||
Expires: claim.ExpiresAt.Time,
|
||||
HttpOnly: true,
|
||||
SameSite: http.SameSiteLaxMode,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user