mirror of
https://github.com/h44z/wg-portal
synced 2025-02-26 05:49:14 +00:00
configurable cert-check for the ldap auth provider (#12)
This commit is contained in:
parent
e65a4a8148
commit
7042523c54
@ -175,14 +175,15 @@ func (provider Provider) GetUserModel(ctx *authentication.AuthContext) (*authent
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (provider Provider) open() (*ldap.Conn, error) {
|
func (provider Provider) open() (*ldap.Conn, error) {
|
||||||
conn, err := ldap.DialURL(provider.config.URL)
|
tlsConfig := &tls.Config{InsecureSkipVerify: !provider.config.CertValidation}
|
||||||
|
conn, err := ldap.DialURL(provider.config.URL, ldap.DialWithTLSConfig(tlsConfig))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if provider.config.StartTLS {
|
if provider.config.StartTLS {
|
||||||
// Reconnect with TLS
|
// Reconnect with TLS
|
||||||
err = conn.StartTLS(&tls.Config{InsecureSkipVerify: !provider.config.CertValidation})
|
err = conn.StartTLS(tlsConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user