From d44244e8d7ef24144253586ef31050f4fa84c19c Mon Sep 17 00:00:00 2001 From: mo khan Date: Sun, 11 May 2025 21:29:09 -0600 Subject: refactor: inline unncessary method --- app/controllers/sessions/service.go | 3 +-- pkg/web/cookie.go | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/app/controllers/sessions/service.go b/app/controllers/sessions/service.go index 79ffad6..c0466e4 100644 --- a/app/controllers/sessions/service.go +++ b/app/controllers/sessions/service.go @@ -11,7 +11,6 @@ import ( "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/cfg" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/oidc" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/pls" - "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/web" "golang.org/x/oauth2" ) @@ -44,7 +43,7 @@ func (svc *Service) Exchange(r *http.Request) (*oidc.Tokens, error) { } state := r.URL.Query().Get("state") - if state != web.CookieValueFrom(cookies[0]) { + if state != cookies[0].Value { return nil, errors.New("Invalid CSRF token") } diff --git a/pkg/web/cookie.go b/pkg/web/cookie.go index c5391e9..11cc807 100644 --- a/pkg/web/cookie.go +++ b/pkg/web/cookie.go @@ -26,10 +26,6 @@ func ExpireCookie(w http.ResponseWriter, name string) error { )) } -func CookieValueFrom(c *http.Cookie) string { - return c.Value -} - func WriteCookie(w http.ResponseWriter, c *http.Cookie) error { if err := c.Valid(); err != nil { return err -- cgit v1.2.3