diff options
| author | mo khan <mo@mokhan.ca> | 2025-05-08 00:11:09 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-05-08 00:11:09 -0600 |
| commit | 8b1e0d187394bde78ecef697f70a4f881e80ace4 (patch) | |
| tree | e52f505a279175632fdcb599df508bac2c2c6929 /app | |
| parent | c8330d530e63437687f0f83364283a7e24119fd0 (diff) | |
chore: log the generated cookie
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/sessions/controller.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/sessions/controller.go b/app/controllers/sessions/controller.go index fdda36d..50a81ff 100644 --- a/app/controllers/sessions/controller.go +++ b/app/controllers/sessions/controller.go @@ -5,6 +5,7 @@ import ( "time" "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" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/pls" @@ -139,11 +140,12 @@ func (c *Controller) Create(w http.ResponseWriter, r *http.Request) { return } - err = web.WriteCookie(w, web.NewCookie("session", encoded, + ck := web.NewCookie("session", encoded, cookie.WithSameSite(http.SameSiteLaxMode), cookie.WithExpiration(tokens.Expiry), - )) - if err != nil { + ) + log.WithFields(r.Context(), log.Fields{"cookie": ck}) + if err := web.WriteCookie(w, ck); err != nil { pls.LogError(r.Context(), err) w.WriteHeader(http.StatusBadRequest) return |
