diff --git a/ldapauthenticator/ldapauthenticator.py b/ldapauthenticator/ldapauthenticator.py index 5dde8a6..9745d1c 100644 --- a/ldapauthenticator/ldapauthenticator.py +++ b/ldapauthenticator/ldapauthenticator.py @@ -401,7 +401,7 @@ def get_connection(self, userdn, password): self.server_address, port=self.server_port, use_ssl=self.use_ssl ) auto_bind = ( - self.use_ssl and ldap3.AUTO_BIND_TLS_BEFORE_BIND or ldap3.AUTO_BIND_NO_TLS + ldap3.AUTO_BIND_NO_TLS if use_ssl else ldap3.AUTO_BIND_TLS_BEFORE_BIND ) conn = ldap3.Connection( server, user=userdn, password=password, auto_bind=auto_bind