Skip to content

Commit

Permalink
Fix: Auth no endpoint error (#8407)
Browse files Browse the repository at this point in the history
  • Loading branch information
N-o-Z authored Dec 3, 2024
1 parent 7f58e03 commit 6bb2b58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmd/lakefs/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,20 @@ type Shutter interface {
Shutdown(context.Context) error
}

var errSimplifiedOrExternalAuth = errors.New(`cannot set auth.ui_config.rbac to non-simplified without setting an external auth service`)
var (
errAuthNoEndpoint = errors.New("cannot set auth.ui_config.rbac to non-basic without setting an external auth service endpoint")
errInvalidAuth = errors.New("invalid auth configuration")
)

func checkAuthModeSupport(cfg *config.Config) error {
if cfg.IsAuthBasic() { // Basic mode
return nil
}
if !cfg.IsAuthUISimplified() && !cfg.IsAuthTypeAPI() {
return errSimplifiedOrExternalAuth
if !cfg.IsAuthUISimplified() && !cfg.IsAdvancedAuth() {
return fmt.Errorf("%s: %w", cfg.Auth.UIConfig.RBAC, errInvalidAuth)
}
if !cfg.IsAuthTypeAPI() {
return errAuthNoEndpoint
}
return nil
}
Expand Down
1 change: 1 addition & 0 deletions cmd/lakefs/cmd/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
func TestGetAuthService(t *testing.T) {
t.Run("maintain_inviter", func(t *testing.T) {
cfg := &config.Config{}
cfg.Auth.UIConfig.RBAC = config.AuthRBACInternal
cfg.Auth.API.Endpoint = "http://localhost:8000"
cfg.Auth.API.SkipHealthCheck = true
service := cmd.NewAuthService(context.Background(), cfg, logging.ContextUnavailable(), nil, nil)
Expand Down

0 comments on commit 6bb2b58

Please sign in to comment.