Skip to content

Commit

Permalink
Merge pull request #1278 from s-urbaniak/ldap-config
Browse files Browse the repository at this point in the history
Bug 2037274: pkg/security/ldapclient: add configuration for connection verification
  • Loading branch information
openshift-merge-robot authored Jan 10, 2022
2 parents 1f38a6c + d41fdca commit 1ad5cdd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/security/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
reviewers:
- ibihim
- s-urbaniak
- slaskawi
- stlaz
approvers:
- stlaz
7 changes: 7 additions & 0 deletions pkg/security/ldapclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import (

// NewLDAPClientConfig returns a new LDAP client config
func NewLDAPClientConfig(URL, bindDN, bindPassword, CA string, insecure bool) (Config, error) {
return NewLDAPClientConfigWithTLSConnectionVerification(URL, bindDN, bindPassword, CA, insecure, nil)
}

// NewLDAPClientConfig returns a new LDAP client config
func NewLDAPClientConfigWithTLSConnectionVerification(URL, bindDN, bindPassword, CA string, insecure bool, verifyFn func(tls.ConnectionState) error) (Config, error) {
url, err := ldaputil.ParseURL(URL)
if err != nil {
return nil, fmt.Errorf("Error parsing URL: %v", err)
Expand All @@ -27,6 +32,8 @@ func NewLDAPClientConfig(URL, bindDN, bindPassword, CA string, insecure bool) (C
tlsConfig.RootCAs = roots
}

tlsConfig.VerifyConnection = verifyFn

return &ldapClientConfig{
scheme: url.Scheme,
host: url.Host,
Expand Down

0 comments on commit 1ad5cdd

Please sign in to comment.