mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-27 05:49:04 +01:00
Remove needless tls option in ldap config
Go's LDAP client uses tls automatically if the url starts with 'ldaps'.
This commit is contained in:
parent
ec1f200061
commit
6d0a4a91a3
13
auth/ldap.go
13
auth/ldap.go
@ -1,7 +1,6 @@
|
|||||||
package auth
|
package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
@ -18,10 +17,7 @@ type LdapConfig struct {
|
|||||||
SearchDN string `json:"search_dn"`
|
SearchDN string `json:"search_dn"`
|
||||||
UserBind string `json:"user_bind"`
|
UserBind string `json:"user_bind"`
|
||||||
UserFilter string `json:"user_filter"`
|
UserFilter string `json:"user_filter"`
|
||||||
TLS bool `json:"tls"`
|
SyncInterval string `json:"sync_interval"` // Parsed using time.ParseDuration.
|
||||||
|
|
||||||
// Parsed using time.ParseDuration.
|
|
||||||
SyncInterval string `json:"sync_interval"`
|
|
||||||
SyncDelOldUsers bool `json:"sync_del_old_users"`
|
SyncDelOldUsers bool `json:"sync_del_old_users"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,13 +60,6 @@ func (auth *Authentication) getLdapConnection(admin bool) (*ldap.Conn, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if auth.ldapConfig.TLS {
|
|
||||||
if err := conn.StartTLS(&tls.Config{InsecureSkipVerify: true}); err != nil {
|
|
||||||
conn.Close()
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if admin {
|
if admin {
|
||||||
if err := conn.Bind(auth.ldapConfig.SearchDN, auth.ldapSyncUserPassword); err != nil {
|
if err := conn.Bind(auth.ldapConfig.SearchDN, auth.ldapSyncUserPassword); err != nil {
|
||||||
conn.Close()
|
conn.Close()
|
||||||
|
Loading…
Reference in New Issue
Block a user