Documentation
¶
Index ¶
- func Dial(opts *DialOptions) (conn net.Conn, err error)
- func ListSupportedAuthTypes(quote bool) []string
- type AuthType
- type BindParameters
- func (p *BindParameters) SetDefaults()
- func (p *BindParameters) SetDomain(domain string) *BindParameters
- func (p *BindParameters) SetPassword(password string) *BindParameters
- func (p *BindParameters) SetType(authType AuthType) *BindParameters
- func (p *BindParameters) SetUser(user string) *BindParameters
- func (p *BindParameters) Validate() error
- type Connection
- type DialOptions
- func (o *DialOptions) SetDefaults()
- func (o *DialOptions) SetMaxRetries(retries uint) *DialOptions
- func (o *DialOptions) SetSizeLimit(limit int64) *DialOptions
- func (o *DialOptions) SetTLSConfig(conf *tls.Config) *DialOptions
- func (o *DialOptions) SetTimeLimit(limit time.Duration) *DialOptions
- func (o *DialOptions) SetURL(addr string) *DialOptions
- func (o *DialOptions) Validate() error
- type Port
- type Scheme
- type URL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListSupportedAuthTypes ¶
Types ¶
type BindParameters ¶
type BindParameters struct {
// Type of authentication
AuthType AuthType `validate:"required,is_valid"` // default: SIMPLE
// User's domain (required for NTLM authentication)
Domain string `validate:"required_if=AuthType NTLM"`
// User's password
Password string `validate:"required_unless=AuthType UNAUTHENTICATED"`
// Username
User string `validate:"required_unless=AuthType UNAUTHENTICATED"`
}
Bind parameters
func NewBindParameters ¶
func NewBindParameters() *BindParameters
func (*BindParameters) SetDomain ¶
func (p *BindParameters) SetDomain(domain string) *BindParameters
Set domain (required for NTLM-based authentication)
func (*BindParameters) SetPassword ¶
func (p *BindParameters) SetPassword(password string) *BindParameters
Set password
func (*BindParameters) SetType ¶
func (p *BindParameters) SetType(authType AuthType) *BindParameters
Set authentication type
func (*BindParameters) SetUser ¶
func (p *BindParameters) SetUser(user string) *BindParameters
Set username
type Connection ¶
type Connection struct {
*ldap.Conn
*DialOptions
// contains filtered or unexported fields
}
Connection object
func Bind ¶
func Bind(parameters *BindParameters, options *DialOptions) (*Connection, error)
Establish connection with the server
func (Connection) Close ¶
func (c Connection) Close() error
func (Connection) RemoteHost ¶
func (c Connection) RemoteHost() string
type DialOptions ¶
type DialOptions struct {
// Number of max retries if failing
MaxRetries uint `validate:"required" default:"3"`
// Limits number of objects returned by an LDAP query
SizeLimit int64
// Timeout for connection handshake and LDAP queries
TimeLimit time.Duration `validate:"required" default:"10s"`
// Custom TLS config
TLSConfig *tls.Config
// Server URL
URL *URL `validate:"required,is_valid"` // default: ldap://localhost:389
}
Options for dialer
func NewDialOptions ¶
func NewDialOptions() *DialOptions
func (*DialOptions) SetMaxRetries ¶
func (o *DialOptions) SetMaxRetries(retries uint) *DialOptions
Set max retries
func (*DialOptions) SetSizeLimit ¶
func (o *DialOptions) SetSizeLimit(limit int64) *DialOptions
Set size limit
func (*DialOptions) SetTLSConfig ¶
func (o *DialOptions) SetTLSConfig(conf *tls.Config) *DialOptions
Set custom TLS config
func (*DialOptions) SetTimeLimit ¶
func (o *DialOptions) SetTimeLimit(limit time.Duration) *DialOptions
Set time limit
type URL ¶
type URL struct {
// Scheme
Scheme Scheme `validate:"required,is_valid"`
// Server's domain name
Host string `validate:"required"`
// Server's port
Port Port `validate:"required,gt=0"`
}
Server's URL
func URLFromString ¶
Parse URL from string matching <scheme>://<hostname>:<port>
Click to show internal directories.
Click to hide internal directories.