Add "insecure" flag to graph LDAP backend

To allow skipping TLS Certificate verification in development
environments.
This commit is contained in:
Ralf Haferkamp
2022-02-09 18:29:57 +01:00
parent 21c7b10f98
commit 8a57545c30
4 changed files with 42 additions and 14 deletions
+14 -3
View File
@@ -59,10 +59,21 @@ func NewService(opts ...Option) Service {
}
case "ldap":
var err error
var tlsConf *tls.Config
if options.Config.Identity.LDAP.Insecure {
tlsConf = &tls.Config{
InsecureSkipVerify: true,
}
}
conn := ldap.NewLDAPWithReconnect(&options.Logger,
options.Config.Identity.LDAP.URI,
options.Config.Identity.LDAP.BindDN,
options.Config.Identity.LDAP.BindPassword,
ldap.Config{
URI: options.Config.Identity.LDAP.URI,
BindDN: options.Config.Identity.LDAP.BindDN,
BindPassword: options.Config.Identity.LDAP.BindPassword,
TLSConfig: tlsConf,
},
)
if backend, err = identity.NewLDAPBackend(conn, options.Config.Identity.LDAP, &options.Logger); err != nil {
options.Logger.Error().Msgf("Error initializing LDAP Backend: '%s'", err)