ldap.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. AllowGroup string `mapstructure:"allow-group"` // Which group is allowed to login
  14. }
  15. // type LdapGroup struct {
  16. // BaseDn string `mapstructure:"base-dn"` // The base DN of the group for searching
  17. // Name string `mapstructure:"name"` // The attribute name of the group
  18. // Filter string `mapstructure:"filter"`
  19. // Admin string `mapstructure:"admin"` // Which group is the admin group
  20. // Member string `mapstructure:"member"` // How to get the member of the group: member, uniqueMember, or memberOf (default: member)
  21. // Mode string `mapstructure:"mode"`
  22. // Map map[string]string `mapstructure:"map"` // If mode is "map", map the LDAP group to the internal group
  23. // }
  24. type Ldap struct {
  25. Enable bool `mapstructure:"enable"`
  26. Url string `mapstructure:"url"`
  27. TlsCaFile string `mapstructure:"tls-ca-file"`
  28. TlsVerify bool `mapstructure:"tls-verify"`
  29. BaseDn string `mapstructure:"base-dn"`
  30. BindDn string `mapstructure:"bind-dn"`
  31. BindPassword string `mapstructure:"bind-password"`
  32. User LdapUser `mapstructure:"user"`
  33. // Group LdapGroup `mapstructure:"group"`
  34. }