From 513c943e87721f42918b30a61294a295e16862b4 Mon Sep 17 00:00:00 2001 From: Margo Crawford Date: Wed, 19 Jan 2022 13:29:26 -0800 Subject: [PATCH] Keep all scopes except offline_access in integration test --- test/integration/supervisor_login_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/integration/supervisor_login_test.go b/test/integration/supervisor_login_test.go index 5fdd6060..1fec0989 100644 --- a/test/integration/supervisor_login_test.go +++ b/test/integration/supervisor_login_test.go @@ -136,6 +136,17 @@ func TestSupervisorLogin(t *testing.T) { }, createIDP: func(t *testing.T) string { t.Helper() + var additionalScopes []string + // keep all the scopes except for offline access so we can test the access token based refresh flow. + if len(env.ToolsNamespace) == 0 { + additionalScopes = env.SupervisorUpstreamOIDC.AdditionalScopes + } else { + for _, additionalScope := range env.SupervisorUpstreamOIDC.AdditionalScopes { + if additionalScope != "offline_access" { + additionalScopes = append(additionalScopes, additionalScope) + } + } + } oidcIDP := testlib.CreateTestOIDCIdentityProvider(t, idpv1alpha1.OIDCIdentityProviderSpec{ Issuer: env.SupervisorUpstreamOIDC.Issuer, TLS: &idpv1alpha1.TLSSpec{ @@ -149,7 +160,7 @@ func TestSupervisorLogin(t *testing.T) { Groups: env.SupervisorUpstreamOIDC.GroupsClaim, }, AuthorizationConfig: idpv1alpha1.OIDCAuthorizationConfig{ - AdditionalScopes: []string{"email"}, // does not ask for offline_access. + AdditionalScopes: additionalScopes, }, }, idpv1alpha1.PhaseReady) return oidcIDP.Name