ldap.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. package config
  2. type LdapUser struct {
  3. BaseDn string `mapstructure:"base-dn"` // The base DN of the user for searching
  4. EnableAttr string `mapstructure:"enable-attr"` // The attribute name of the user for enabling, in AD it is "userAccountControl", empty means no enable attribute, all users are enabled
  5. EnableAttrValue string `mapstructure:"enable-attr-value"` // The value of the enable attribute when the user is enabled. If you are using AD, just leave it random str, it will be ignored.
  6. Filter string `mapstructure:"filter"`
  7. Username string `mapstructure:"username"`
  8. Email string `mapstructure:"email"`
  9. FirstName string `mapstructure:"first-name"`
  10. LastName string `mapstructure:"last-name"`
  11. Sync bool `mapstructure:"sync"` // Will sync the user's information to the internal database
  12. AdminGroup string `mapstructure:"admin-group"` // Which group is the admin group
  13. }
  14. // type LdapGroup struct {
  15. // BaseDn string `mapstructure:"base-dn"` // The base DN of the group for searching
  16. // Name string `mapstructure:"name"` // The attribute name of the group
  17. // Filter string `mapstructure:"filter"`
  18. // Admin string `mapstructure:"admin"` // Which group is the admin group
  19. // Member string `mapstructure:"member"` // How to get the member of the group: member, uniqueMember, or memberOf (default: member)
  20. // Mode string `mapstructure:"mode"`
  21. // Map map[string]string `mapstructure:"map"` // If mode is "map", map the LDAP group to the internal group
  22. // }
  23. type Ldap struct {
  24. Enable bool `mapstructure:"enable"`
  25. Url string `mapstructure:"url"`
  26. TLS bool `mapstructure:"tls"`
  27. TlsVerify bool `mapstructure:"tls-verify"`
  28. BaseDn string `mapstructure:"base-dn"`
  29. BindDn string `mapstructure:"bind-dn"`
  30. BindPassword string `mapstructure:"bind-password"`
  31. User LdapUser `mapstructure:"user"`
  32. // Group LdapGroup `mapstructure:"group"`
  33. }