Skip to content

Commit

Permalink
chore: Init userpasswd provider where we initialize every other authn…
Browse files Browse the repository at this point in the history
… provider

Just a little cleanup which makes the main function a bit shorter and easier to understand that userpasswd is not different to other authn providers.

Test plan: Authn with builtin still works in CI integration tests.
  • Loading branch information
eseliger committed Jul 31, 2024
1 parent 2193422 commit c882243
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions cmd/frontend/internal/auth/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ go_library(
"//cmd/frontend/internal/auth/openidconnect",
"//cmd/frontend/internal/auth/saml",
"//cmd/frontend/internal/auth/sourcegraphoperator",
"//cmd/frontend/internal/auth/userpasswd",
"//internal/conf",
"//internal/database",
"//internal/licensing",
Expand Down
3 changes: 2 additions & 1 deletion cmd/frontend/internal/auth/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import (
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/authutil"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/azureoauth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/bitbucketcloudoauth"

"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/gerrit"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/githuboauth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/gitlaboauth"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/httpheader"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/openidconnect"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/saml"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/sourcegraphoperator"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/userpasswd"
"github.com/sourcegraph/sourcegraph/internal/conf"
"github.com/sourcegraph/sourcegraph/internal/database"
"github.com/sourcegraph/sourcegraph/internal/licensing"
Expand All @@ -29,6 +29,7 @@ import (
// Init must be called by the frontend to initialize the auth middlewares.
func Init(logger log.Logger, db database.DB) {
logger = logger.Scoped("auth")
userpasswd.Init()
azureoauth.Init(logger, db)
bitbucketcloudoauth.Init(logger, db)
gerrit.Init()
Expand Down
1 change: 0 additions & 1 deletion cmd/frontend/internal/cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ go_library(
"//cmd/frontend/internal/app/ui",
"//cmd/frontend/internal/auth/ipallowlist",
"//cmd/frontend/internal/auth/session",
"//cmd/frontend/internal/auth/userpasswd",
"//cmd/frontend/internal/authz",
"//cmd/frontend/internal/bg",
"//cmd/frontend/internal/cli/middleware",
Expand Down
2 changes: 0 additions & 2 deletions cmd/frontend/internal/cli/serve_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/sourcegraph/sourcegraph/cmd/frontend/globals"
"github.com/sourcegraph/sourcegraph/cmd/frontend/graphqlbackend"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/app/ui"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/auth/userpasswd"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/bg"
"github.com/sourcegraph/sourcegraph/cmd/frontend/internal/httpapi"
oce "github.com/sourcegraph/sourcegraph/cmd/frontend/oneclickexport"
Expand Down Expand Up @@ -127,7 +126,6 @@ func Main(ctx context.Context, observationCtx *observation.Context, ready servic
}
}

userpasswd.Init()
highlight.Init()

// override site config first
Expand Down

0 comments on commit c882243

Please sign in to comment.