summaryrefslogtreecommitdiff
path: root/app/controllers/sessions/controller.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-05-07 08:46:32 -0700
committermo khan <mo@mokhan.ca>2025-05-07 08:46:32 -0700
commitf417e03cb09024743baf2f749e4309032afd5f39 (patch)
treec2449a35404af96a2395f8716a0901a80c63bf94 /app/controllers/sessions/controller.go
parentd3cb17f8032d95f0f8805a0ce74fe5fc41714bb8 (diff)
refactor: delegate to cookie package
Diffstat (limited to 'app/controllers/sessions/controller.go')
-rw-r--r--app/controllers/sessions/controller.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/controllers/sessions/controller.go b/app/controllers/sessions/controller.go
index b9240c6..50aac63 100644
--- a/app/controllers/sessions/controller.go
+++ b/app/controllers/sessions/controller.go
@@ -4,6 +4,7 @@ import (
"net/http"
"time"
+ xcookie "github.com/xlgmokha/x/pkg/cookie"
"github.com/xlgmokha/x/pkg/log"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/middleware"
"gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/oidc"
@@ -37,8 +38,8 @@ func (c *Controller) New(w http.ResponseWriter, r *http.Request) {
http.SetCookie(w, cookie.New(
"oauth_state",
nonce,
- cookie.WithSameSite(http.SameSiteLaxMode),
- cookie.WithExpiration(time.Now().Add(10*time.Minute)),
+ xcookie.WithSameSite(http.SameSiteLaxMode),
+ xcookie.WithExpiration(time.Now().Add(10*time.Minute)),
))
http.Redirect(w, r, url, http.StatusFound)
}
@@ -138,7 +139,7 @@ func (c *Controller) Create(w http.ResponseWriter, r *http.Request) {
return
}
- http.SetCookie(w, cookie.New("session", encoded, cookie.WithExpiration(tokens.Expiry)))
+ http.SetCookie(w, cookie.New("session", encoded, xcookie.WithExpiration(tokens.Expiry)))
http.Redirect(w, r, "/dashboard", http.StatusFound)
}