fix ldaps protocol (#6384)
fix: ldap default protocol (#2156) Signed-off-by: peng wu <2030047311@qq.com>
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"net"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-ldap/ldap"
|
||||
@@ -165,7 +166,11 @@ func (l ldapProvider) Authenticate(username string, password string) (identitypr
|
||||
}
|
||||
|
||||
func (l *ldapProvider) newConn() (*ldap.Conn, error) {
|
||||
lurl, err := url.Parse(l.Host)
|
||||
host := l.Host
|
||||
if !strings.HasPrefix(l.Host, "ldap://") && !strings.HasPrefix(l.Host, "ldaps://") {
|
||||
host = "ldap://" + l.Host
|
||||
}
|
||||
lurl, err := url.Parse(host)
|
||||
if err != nil {
|
||||
return nil, ldap.NewError(ldap.ErrorNetwork, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user