Compare commits

..

No commits in common. "592749eebf176e9ba508ac35008f476c354c5a0f" and "194c1864c4b864a32d2f451daed37aa2ca64a004" have entirely different histories.

2 changed files with 24 additions and 33 deletions

View File

@ -117,9 +117,3 @@ WERTHER_LDAP_ROLE_BASEDN=ou=groups,dc=myorg,dc=com
# [type] String
# [default] /
# [required]
#WERTHER_LDAP_CONNECTION_TIMEOUT=
# [description] LDAP server connection timeout
# [type] Duration
# [default] 60s
# [required]

View File

@ -61,7 +61,6 @@ type Config struct {
CacheSize int `envconfig:"cache_size" default:"512" desc:"a user info cache's size in KiB"`
CacheTTL time.Duration `envconfig:"cache_ttl" default:"30m" desc:"a user info cache TTL"`
IsTLS bool `envconfig:"is_tls" default:"false" desc:"should LDAP connection be established via TLS"`
ConnectionTimeout time.Duration `envconfig:"connection_timeout" default:"60s" desc:"LDAP server connection timeout"`
}
// Client is a LDAP client (compatible with Active Directory).
@ -81,7 +80,6 @@ func New(cnf Config) *Client {
RoleBaseDN: cnf.RoleBaseDN,
IsTLS: cnf.IsTLS,
RoleSearchQuery: cnf.RoleSearchQuery,
ConnectionTimeout: cnf.ConnectionTimeout,
},
cache: freecache.NewCache(cnf.CacheSize * 1024),
}
@ -298,11 +296,10 @@ type ldapConnector struct {
IsTLS bool
UserSearchQuery string
RoleSearchQuery string
ConnectionTimeout time.Duration
}
func (c *ldapConnector) Connect(ctx context.Context, addr string) (conn, error) {
d := net.Dialer{Timeout: c.ConnectionTimeout}
d := net.Dialer{Timeout: ldap.DefaultTimeout}
tcpcn, err := d.DialContext(ctx, "tcp", addr)
if err != nil {
return nil, err