3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-28 21:52:36 +01:00
ergo/irc/ldap/config.go

63 lines
1.9 KiB
Go
Raw Normal View History

// Copyright 2014-2018 Grafana Labs
// Released under the Apache 2.0 license
2020-02-11 12:35:17 +01:00
// Modification notice:
// 1. All field names were changed from toml and snake case to yaml and kebab case,
// matching the Oragono project conventions
2020-02-12 04:08:41 +01:00
// 2. Four fields were added:
// 2.1 `Enabled`
// 2.2 `Autocreate`
// 2.3 `Timeout`
// 2.4 `RequireGroups`
// XXX: none of AttributeMap does anything in oragono, except MemberOf,
// which can be used to retrieve group memberships
2020-02-11 12:35:17 +01:00
package ldap
import (
"time"
)
type ServerConfig struct {
2020-02-11 12:35:17 +01:00
Enabled bool
Autocreate bool
Host string
Port int
Timeout time.Duration
UseSSL bool `yaml:"use-ssl"`
StartTLS bool `yaml:"start-tls"`
SkipVerifySSL bool `yaml:"ssl-skip-verify"`
2020-02-11 12:35:17 +01:00
RootCACert string `yaml:"root-ca-cert"`
ClientCert string `yaml:"client-cert"`
ClientKey string `yaml:"client-key"`
BindDN string `yaml:"bind-dn"`
BindPassword string `yaml:"bind-password"`
SearchFilter string `yaml:"search-filter"`
SearchBaseDNs []string `yaml:"search-base-dns"`
// user validation: require them to be in any one of these groups
RequireGroups []string `yaml:"require-groups"`
// two ways of testing group membership:
// either by searching for groups that match the user's DN
2020-02-11 12:35:17 +01:00
// and testing their names:
GroupSearchFilter string `yaml:"group-search-filter"`
GroupSearchFilterUserAttribute string `yaml:"group-search-filter-user-attribute"`
GroupSearchBaseDNs []string `yaml:"group-search-base-dns"`
// or by an attribute on the user's DN, typically named 'memberOf', but customizable:
Attr AttributeMap `yaml:"attributes"`
2020-02-11 12:35:17 +01:00
}
// AttributeMap is a struct representation for LDAP "attributes" setting
type AttributeMap struct {
Username string
Name string
Surname string
Email string
MemberOf string `yaml:"member-of"`
2020-02-11 12:35:17 +01:00
}