You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.go 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2014-2018 Grafana Labs
  2. // Released under the Apache 2.0 license
  3. // Modification notice:
  4. // 1. All field names were changed from toml and snake case to yaml and kebab case,
  5. // matching the Oragono project conventions
  6. // 2. Four fields were added:
  7. // 2.1 `Enabled`
  8. // 2.2 `Autocreate`
  9. // 2.3 `Timeout`
  10. // 2.4 `RequireGroups`
  11. // XXX: none of AttributeMap does anything in oragono, except MemberOf,
  12. // which can be used to retrieve group memberships
  13. package ldap
  14. import (
  15. "time"
  16. )
  17. type ServerConfig struct {
  18. Enabled bool
  19. Autocreate bool
  20. Host string
  21. Port int
  22. Timeout time.Duration
  23. UseSSL bool `yaml:"use-ssl"`
  24. StartTLS bool `yaml:"start-tls"`
  25. SkipVerifySSL bool `yaml:"ssl-skip-verify"`
  26. RootCACert string `yaml:"root-ca-cert"`
  27. ClientCert string `yaml:"client-cert"`
  28. ClientKey string `yaml:"client-key"`
  29. BindDN string `yaml:"bind-dn"`
  30. BindPassword string `yaml:"bind-password"`
  31. SearchFilter string `yaml:"search-filter"`
  32. SearchBaseDNs []string `yaml:"search-base-dns"`
  33. // user validation: require them to be in any one of these groups
  34. RequireGroups []string `yaml:"require-groups"`
  35. // two ways of testing group membership:
  36. // either by searching for groups that match the user's DN
  37. // and testing their names:
  38. GroupSearchFilter string `yaml:"group-search-filter"`
  39. GroupSearchFilterUserAttribute string `yaml:"group-search-filter-user-attribute"`
  40. GroupSearchBaseDNs []string `yaml:"group-search-base-dns"`
  41. // or by an attribute on the user's DN, typically named 'memberOf', but customizable:
  42. Attr AttributeMap `yaml:"attributes"`
  43. }
  44. // AttributeMap is a struct representation for LDAP "attributes" setting
  45. type AttributeMap struct {
  46. Username string
  47. Name string
  48. Surname string
  49. Email string
  50. MemberOf string `yaml:"member-of"`
  51. }