Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions internal/config/yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,28 @@ func TestStrictYaml(t *testing.T) {
databases_query: [nominal]
ldap:
password: "secret"
rules:
- description: "Readonly"
ldapsearch:
base: "ou=groups,o=test"
scope: one
filter: "(&(objectClass=groupOfNames)(cn=admin)(member=*))"
joins:
member:
scope: base
filter: "(|(objectClass=inetOrgPerson)(objectClass=person))"
roles:
- name: "{member.uid}"
`)
var value map[string]any
yaml.Unmarshal([]byte(rawYaml), &value) //nolint:errcheck
err := yaml.Unmarshal([]byte(rawYaml), &value)
r.Nil(err)

value, err = config.NormalizeConfigRoot(value)
r.Nil(err)

c := config.New()
err := c.DecodeYaml(value)
err = c.DecodeYaml(value)
r.EqualError(err, "invalid configuration file\n'ldap' has invalid keys: password\n'postgres' has invalid keys: uri")
errs := errorlist.Unwrap(err)
r.Len(errs, 3)
Expand Down
2 changes: 1 addition & 1 deletion internal/ldap/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Search struct {
Scope Scope
Filter string
Attributes []string
Subsearches map[string]Subsearch `mapstructure:"joins"`
Subsearches map[string]Subsearch
}

func (s Search) SubsearchAttribute() string {
Expand Down