Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: improve LDAP user filter error messages for better troubleshooting (#18051)
boojackca522abefcf2
diff --git a/backend/plugin/idp/ldap/ldap.go b/backend/plugin/idp/ldap/ldap.goindex a681b24a84..5afb55b54a 100644--- a/backend/plugin/idp/ldap/ldap.go+++ b/backend/plugin/idp/ldap/ldap.go@@ -148,8 +148,11 @@ func (p *IdentityProvider) Authenticate(username, password string) (*storepb.Ide)if err != nil {return nil, errors.Errorf("search user DN: %v", err)- } else if len(sr.Entries) != 1 {- return nil, errors.Errorf("expect 1 user DN but got %d", len(sr.Entries))+ }+ if len(sr.Entries) == 0 {+ return nil, errors.Errorf("user filter matched no users; the filter may be too restrictive or the user does not exist in the directory (filter: %q, baseDN: %q)", p.config.UserFilter, p.config.BaseDN)+ } else if len(sr.Entries) > 1 {+ return nil, errors.Errorf("user filter matched %d users but must match exactly one; the filter is too broad and needs to be more specific (filter: %q, baseDN: %q)", len(sr.Entries), p.config.UserFilter, p.config.BaseDN)}entry := sr.Entries[0]