mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: rename git_auth to external_auth in our schema (#9935)
* chore: rename `git_auth` to `external_auth` in our schema We're changing Git auth to be external auth. It will support any OAuth2 or OIDC provider. To split up the larger change I want to contribute the schema changes first, and I'll add the feature itself in another PR. * Fix names * Fix outdated view * Rename some additional places * Fix sort order * Fix template versions auth route * Fix types * Fix dbauthz
This commit is contained in:
@@ -331,18 +331,18 @@ func TestTemplateVersionsGitAuth(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
|
||||
defer cancel()
|
||||
|
||||
_, err := client.TemplateVersionGitAuth(ctx, version.ID)
|
||||
_, err := client.TemplateVersionExternalAuth(ctx, version.ID)
|
||||
require.NoError(t, err)
|
||||
})
|
||||
t.Run("Authenticated", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
client := coderdtest.New(t, &coderdtest.Options{
|
||||
IncludeProvisionerDaemon: true,
|
||||
GitAuthConfigs: []*gitauth.Config{{
|
||||
ExternalAuthConfigs: []*gitauth.Config{{
|
||||
OAuth2Config: &testutil.OAuth2Config{},
|
||||
ID: "github",
|
||||
Regex: regexp.MustCompile(`github\.com`),
|
||||
Type: codersdk.GitProviderGitHub,
|
||||
Type: codersdk.ExternalAuthProviderGitHub,
|
||||
}},
|
||||
})
|
||||
user := coderdtest.CreateFirstUser(t, client)
|
||||
@@ -362,7 +362,7 @@ func TestTemplateVersionsGitAuth(t *testing.T) {
|
||||
defer cancel()
|
||||
|
||||
// Not authenticated to start!
|
||||
providers, err := client.TemplateVersionGitAuth(ctx, version.ID)
|
||||
providers, err := client.TemplateVersionExternalAuth(ctx, version.ID)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, providers, 1)
|
||||
require.False(t, providers[0].Authenticated)
|
||||
@@ -373,7 +373,7 @@ func TestTemplateVersionsGitAuth(t *testing.T) {
|
||||
require.Equal(t, http.StatusTemporaryRedirect, resp.StatusCode)
|
||||
|
||||
// Ensure that the returned Git auth for the template is authenticated!
|
||||
providers, err = client.TemplateVersionGitAuth(ctx, version.ID)
|
||||
providers, err = client.TemplateVersionExternalAuth(ctx, version.ID)
|
||||
require.NoError(t, err)
|
||||
require.Len(t, providers, 1)
|
||||
require.True(t, providers[0].Authenticated)
|
||||
|
||||
Reference in New Issue
Block a user