diff options
| author | mo khan <mo@mokhan.ca> | 2025-05-14 17:14:12 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-05-14 17:14:12 -0600 |
| commit | 4a090d42089ded8ce38be51d08776131a6dd2e05 (patch) | |
| tree | 2955e79404c1c7449bd847471690b545a5484e8c /app/middleware | |
| parent | 7b74ddbe8478bbf901685cea7826d96f042c142e (diff) | |
refactor: remove unnecessary params from ctor
Diffstat (limited to 'app/middleware')
| -rw-r--r-- | app/middleware/id_token_test.go | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/app/middleware/id_token_test.go b/app/middleware/id_token_test.go index 3df9a7d..b363d2c 100644 --- a/app/middleware/id_token_test.go +++ b/app/middleware/id_token_test.go @@ -1,38 +1,23 @@ package middleware import ( - "context" "net/http" - "os" "testing" "github.com/oauth2-proxy/mockoidc" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/xlgmokha/x/pkg/log" "github.com/xlgmokha/x/pkg/test" 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" - "golang.org/x/oauth2" ) func TestIDToken(t *testing.T) { srv := oidc.NewTestServer(t) defer srv.Close() - client := &http.Client{Transport: &web.Transport{Logger: log.New(os.Stdout, log.Fields{})}} - cfg := srv.MockOIDC.Config() - ctx := context.WithValue(t.Context(), oauth2.HTTPClient, client) - openID, err := oidc.New( - ctx, - srv.Provider, - cfg.ClientID, - cfg.ClientSecret, - "https://example.com/oauth/callback", - ) - require.NoError(t, err) - + openID := oidc.New(srv.Provider, srv.MockOIDC.ClientID, srv.MockOIDC.ClientSecret, "https://example.com/oauth/callback") middleware := IDToken(openID, IDTokenFromSessionCookie) t.Run("when an active session cookie is provided", func(t *testing.T) { |
