X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b1d77b59f5b62e34f1a32957c35b334c96888f89..1c0fefc8ec275b53d4adef0546e2c3b8847d8b93:/lib/controller/localdb/login_oidc_test.go diff --git a/lib/controller/localdb/login_oidc_test.go b/lib/controller/localdb/login_oidc_test.go index 5088de6bad..9469fdfd31 100644 --- a/lib/controller/localdb/login_oidc_test.go +++ b/lib/controller/localdb/login_oidc_test.go @@ -44,7 +44,7 @@ type OIDCLoginSuite struct { } func (s *OIDCLoginSuite) SetUpTest(c *check.C) { - s.trustedURL = &arvados.URL{Scheme: "https", Host: "app.example.com", Path: "/"} + s.trustedURL = &arvados.URL{Scheme: "https", Host: "app.example.com:443", Path: "/"} s.fakeProvider = arvadostest.NewOIDCProvider(c) s.fakeProvider.AuthEmail = "active-user@arvados.local" @@ -255,7 +255,7 @@ func (s *OIDCLoginSuite) TestOIDCAuthorizer(c *check.C) { cleanup() defer cleanup() - ctx := auth.NewContext(context.Background(), &auth.Credentials{Tokens: []string{accessToken}}) + ctx := ctrlctx.NewWithToken(s.ctx, s.cluster, accessToken) // Check behavior on 5xx/network errors (don't cache) vs 4xx // (do cache) @@ -357,7 +357,7 @@ func (s *OIDCLoginSuite) TestOIDCAuthorizer(c *check.C) { s.fakeProvider.AccessTokenPayload = map[string]interface{}{"scope": "openid profile foobar"} accessToken = s.fakeProvider.ValidAccessToken() - ctx = auth.NewContext(context.Background(), &auth.Credentials{Tokens: []string{accessToken}}) + ctx = ctrlctx.NewWithToken(s.ctx, s.cluster, accessToken) mac = hmac.New(sha256.New, []byte(s.cluster.SystemRootToken)) io.WriteString(mac, accessToken) @@ -523,7 +523,7 @@ func (s *OIDCLoginSuite) TestGoogleLogin_Success(c *check.C) { // Try using the returned Arvados token. c.Logf("trying an API call with new token %q", token) - ctx := auth.NewContext(context.Background(), &auth.Credentials{Tokens: []string{token}}) + ctx := ctrlctx.NewWithToken(s.ctx, s.cluster, token) cl, err := s.localdb.CollectionList(ctx, arvados.ListOptions{Limit: -1}) c.Check(cl.ItemsAvailable, check.Not(check.Equals), 0) c.Check(cl.Items, check.Not(check.HasLen), 0) @@ -532,7 +532,7 @@ func (s *OIDCLoginSuite) TestGoogleLogin_Success(c *check.C) { // Might as well check that bogus tokens aren't accepted. badtoken := token + "plussomeboguschars" c.Logf("trying an API call with mangled token %q", badtoken) - ctx = auth.NewContext(context.Background(), &auth.Credentials{Tokens: []string{badtoken}}) + ctx = ctrlctx.NewWithToken(s.ctx, s.cluster, badtoken) cl, err = s.localdb.CollectionList(ctx, arvados.ListOptions{Limit: -1}) c.Check(cl.Items, check.HasLen, 0) c.Check(err, check.NotNil)