summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-05-11 21:29:09 -0600
committermo khan <mo@mokhan.ca>2025-05-11 21:29:09 -0600
commitd44244e8d7ef24144253586ef31050f4fa84c19c (patch)
treed57be010560584b2cd0d0d500298ce6546f8ad7f
parent05fae21a33b74e7768a94eb84294f6198c3cec56 (diff)
refactor: inline unncessary method
-rw-r--r--app/controllers/sessions/service.go3
-rw-r--r--pkg/web/cookie.go4
2 files changed, 1 insertions, 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