Skip to content

Commit e87e76e

Browse files
committed
Allow the user to specify tls InsecureSkipVerify and ServerName
1 parent 34a022a commit e87e76e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ldap-client.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ type LDAPClient struct {
2121
UserFilter string // e.g. "(uid=%s)"
2222
Base string
2323
Attributes []string
24+
25+
// Optional fields
26+
InsecureSkipVerify bool
27+
ServerName string
2428
}
2529

2630
// Connect connects to the ldap backend
@@ -41,7 +45,10 @@ func (lc *LDAPClient) Connect() error {
4145
return err
4246
}
4347
} else {
44-
l, err = ldap.DialTLS("tcp", address, &tls.Config{InsecureSkipVerify: false})
48+
l, err = ldap.DialTLS("tcp", address, &tls.Config{
49+
InsecureSkipVerify: lc.InsecureSkipVerify,
50+
ServerName: lc.ServerName,
51+
})
4552
if err != nil {
4653
return err
4754
}

0 commit comments

Comments
 (0)