From ef050c428a0a893607314a4d5d8d441e445e630a Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 7 May 2025 09:06:48 -0700 Subject: refactor: move cookie to web package --- app/middleware/id_token.go | 4 ++-- app/middleware/id_token_test.go | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'app/middleware') diff --git a/app/middleware/id_token.go b/app/middleware/id_token.go index 2bba8ee..bb874e2 100644 --- a/app/middleware/id_token.go +++ b/app/middleware/id_token.go @@ -7,7 +7,7 @@ import ( "github.com/xlgmokha/x/pkg/x" xcfg "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/web/cookie" + "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/web" ) func IDToken(cfg *oidc.OpenID, parsers ...TokenParser) func(http.Handler) http.Handler { @@ -20,7 +20,7 @@ func IDToken(cfg *oidc.OpenID, parsers ...TokenParser) func(http.Handler) http.H if err != nil { log.WithFields(r.Context(), log.Fields{"error": err}) - cookie.Expire(w, "session") + web.ExpireCookie(w, "session") } else { log.WithFields(r.Context(), log.Fields{"id_token": idToken}) next.ServeHTTP( diff --git a/app/middleware/id_token_test.go b/app/middleware/id_token_test.go index 02c2901..06e9c96 100644 --- a/app/middleware/id_token_test.go +++ b/app/middleware/id_token_test.go @@ -15,7 +15,6 @@ import ( "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/oidc" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/test" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/web" - "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/web/cookie" "golang.org/x/oauth2" ) @@ -56,7 +55,7 @@ func TestIDToken(t *testing.T) { r, w := test.RequestResponse( "GET", "/example", - test.WithCookie(cookie.New("session", encoded)), + test.WithCookie(web.NewCookie("session", encoded)), ) server.ServeHTTP(w, r) @@ -75,7 +74,7 @@ func TestIDToken(t *testing.T) { r, w := test.RequestResponse( "GET", "/example", - test.WithCookie(cookie.New("session", "invalid")), + test.WithCookie(web.NewCookie("session", "invalid")), ) server.ServeHTTP(w, r) -- cgit v1.2.3