Documentation ¶
Index ¶
Constants ¶
View Source
const ( LDAP_BIND_DN_KEY = "LDAP_BIND_DN" LDAP_BIND_PASSWORD_KEY = "LDAP_BIND_PASSWORD" LDAP_BIND_ADDRESS = "LDAP_BIND_ADDRESS" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LdapAuth ¶
type LdapAuth struct {
LdapOptions
}
func NewLdapAuth ¶
func NewLdapAuth(opt LdapOptions) *LdapAuth
func (LdapAuth) CreateConn ¶
type LdapConfig ¶
type LdapConfig struct {
Ldap *LdapOptions `mapstructure:"ldap" json:"ldap" yaml:"ldap"`
}
type LdapOptions ¶
type LdapOptions struct { // Enabled enable LDAP basic auth middleware Enabled bool `mapstructure:"enabled" json:"enabled" yaml:"enabled"` // BindDn Search user bind dn (Can be set by env var `LDAP_BIND_DN`) BindDn string `mapstructure:"bind_dn" json:"bind_dn" yaml:"bind_dn"` // BindPassword Search user bind password (Can be set by env var `LDAP_BIND_PASSWORD`) BindPassword string `mapstructure:"bind_password" json:"bind_password" yaml:"bind_password"` // Address LDAP server address in the form of host:port (Can be set by env var `LDAP_BIND_ADDRESS`) Address string `mapstructure:"address" json:"address" yaml:"address"` // UseSsl Set to true if ldap server supports TLS UseSsl bool `mapstructure:"use_ssl" json:"use_ssl" yaml:"use_ssl"` // InsecureSkipVerify Set to true to skip certificate check (NOT RECOMMENDED) InsecureSkipVerify bool `mapstructure:"insecure_skip_verify" json:"insecure_skip_verify" yaml:"insecure_skip_verify"` // SearchBaseDns base dns to search through (Default: `dc=com`) SearchBaseDns string `mapstructure:"search_base_dns" json:"search_base_dns" yaml:"search_base_dns"` // SearchFilter User search filter, for example "(cn=%s)" or "(sAMAccountName=%s)" or "(uid=%s)" (default: `(objectClass=organizationalPerson)&(uid=%s)`) SearchFilter string `mapstructure:"search_filter" json:"search_filter" yaml:"search_filter"` // GroupSearchFilter Group search filter, to retrieve the groups of which the user is a member // Groups will be passed in request context as a list of strings, how to retrieve: ctx.Groups(*http.Request) // if GroupSearchFilter or GroupSearchBaseDns or MemberOf are empty it will not search for groups GroupSearchFilter string `mapstructure:"group_search_filter" json:"group_search_filter" yaml:"group_search_filter"` // GroupSearchBaseDns base DNs to search through for groups GroupSearchBaseDns string `mapstructure:"group_search_base_dns" json:"group_search_base_dns" yaml:"group_search_base_dns"` // MemberOf Search group name by this value (default: `memberOf`) MemberOf string `mapstructure:"member_of" json:"member_of" yaml:"member_of"` // TrustCurrentUser Passthrough if a previous middleware already set user context // This is helpful when you want to add a user with basic auth middleware TrustCurrentUser bool `mapstructure:"trust_current_user" json:"trust_current_user" yaml:"trust_current_user"` }
Click to show internal directories.
Click to hide internal directories.