Skip to content

Commit 5596fb2

Browse files
authored
chore: move /gitauth to /externalauth on the frontend (#9954)
* chore: move `/gitauth` to `/externalauth` on the frontend This actually took a lot more jank than anticipated, so I wanted to split this up before adding the ability to embed new providers. * Rename FE * Fix em' up * Fix linting error * Fix e2e tests * chore: update helm golden files
1 parent 16a2d4d commit 5596fb2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1181
-1161
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"enterprisemeta",
4040
"errgroup",
4141
"eventsourcemock",
42+
"externalauth",
4243
"Failf",
4344
"fatih",
4445
"Formik",

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ site/src/api/typesGenerated.ts: scripts/apitypings/main.go $(shell find ./coders
542542
cd site
543543
pnpm run format:types ./src/api/typesGenerated.ts
544544

545-
site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go
545+
site/e2e/provisionerGenerated.ts: provisionerd/proto/provisionerd.pb.go provisionersdk/proto/provisioner.pb.go
546546
cd site
547547
../scripts/pnpm_install.sh
548548
pnpm run gen:provisioner

cli/create_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
"github.com/coder/coder/v2/cli/clitest"
1616
"github.com/coder/coder/v2/coderd/coderdtest"
17-
"github.com/coder/coder/v2/coderd/gitauth"
17+
"github.com/coder/coder/v2/coderd/externalauth"
1818
"github.com/coder/coder/v2/coderd/util/ptr"
1919
"github.com/coder/coder/v2/codersdk"
2020
"github.com/coder/coder/v2/provisioner/echo"
@@ -600,7 +600,7 @@ func TestCreateWithGitAuth(t *testing.T) {
600600
{
601601
Type: &proto.Response_Plan{
602602
Plan: &proto.PlanComplete{
603-
GitAuthProviders: []string{"github"},
603+
ExternalAuthProviders: []string{"github"},
604604
},
605605
},
606606
},
@@ -609,7 +609,7 @@ func TestCreateWithGitAuth(t *testing.T) {
609609
}
610610

611611
client := coderdtest.New(t, &coderdtest.Options{
612-
ExternalAuthConfigs: []*gitauth.Config{{
612+
ExternalAuthConfigs: []*externalauth.Config{{
613613
OAuth2Config: &testutil.OAuth2Config{},
614614
ID: "github",
615615
Regex: regexp.MustCompile(`github\.com`),
@@ -628,7 +628,7 @@ func TestCreateWithGitAuth(t *testing.T) {
628628
clitest.Start(t, inv)
629629

630630
pty.ExpectMatch("You must authenticate with GitHub to create a workspace")
631-
resp := coderdtest.RequestGitAuthCallback(t, "github", client)
631+
resp := coderdtest.RequestExternalAuthCallback(t, "github", client)
632632
_ = resp.Body.Close()
633633
require.Equal(t, http.StatusTemporaryRedirect, resp.StatusCode)
634634
pty.ExpectMatch("Confirm create?")

cli/server.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ import (
7272
"github.com/coder/coder/v2/coderd/database/migrations"
7373
"github.com/coder/coder/v2/coderd/database/pubsub"
7474
"github.com/coder/coder/v2/coderd/devtunnel"
75-
"github.com/coder/coder/v2/coderd/gitauth"
75+
"github.com/coder/coder/v2/coderd/externalauth"
7676
"github.com/coder/coder/v2/coderd/gitsshkey"
7777
"github.com/coder/coder/v2/coderd/httpapi"
7878
"github.com/coder/coder/v2/coderd/httpmw"
@@ -574,16 +574,16 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
574574
}
575575

576576
vals.GitAuthProviders.Value = append(vals.GitAuthProviders.Value, gitAuthEnv...)
577-
gitAuthConfigs, err := gitauth.ConvertConfig(
577+
externalAuthConfigs, err := externalauth.ConvertConfig(
578578
vals.GitAuthProviders.Value,
579579
vals.AccessURL.Value(),
580580
)
581581
if err != nil {
582-
return xerrors.Errorf("convert git auth config: %w", err)
582+
return xerrors.Errorf("convert external auth config: %w", err)
583583
}
584-
for _, c := range gitAuthConfigs {
584+
for _, c := range externalAuthConfigs {
585585
logger.Debug(
586-
ctx, "loaded git auth config",
586+
ctx, "loaded external auth config",
587587
slog.F("id", c.ID),
588588
)
589589
}
@@ -608,7 +608,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
608608
Pubsub: pubsub.NewInMemory(),
609609
CacheDir: cacheDir,
610610
GoogleTokenValidator: googleTokenValidator,
611-
ExternalAuthConfigs: gitAuthConfigs,
611+
ExternalAuthConfigs: externalAuthConfigs,
612612
RealIPConfig: realIPConfig,
613613
SecureAuthCookie: vals.SecureAuthCookie.Value(),
614614
SSHKeygenAlgorithm: sshKeygenAlgorithm,

0 commit comments

Comments
 (0)