File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -167,20 +167,21 @@ def connection(**kwargs):
167167 # Connect.
168168 try :
169169 # Include SSL / TLS, if requested.
170+ connection_args = {
171+ "user" : username ,
172+ "password" : password ,
173+ "auto_bind" : False ,
174+ "raise_exceptions" : True ,
175+ "receive_timeout" : settings .LDAP_AUTH_RECEIVE_TIMEOUT ,
176+ }
170177 if settings .LDAP_AUTH_USE_TLS :
171- tls = ldap3 .Tls (
178+ connection_args [ " tls" ] = ldap3 .Tls (
172179 ciphers = 'ALL' ,
173180 version = settings .LDAP_AUTH_TLS_VERSION ,
174181 )
175-
176182 c = ldap3 .Connection (
177183 server_pool ,
178- user = username ,
179- password = password ,
180- auto_bind = False ,
181- raise_exceptions = True ,
182- receive_timeout = settings .LDAP_AUTH_RECEIVE_TIMEOUT ,
183- tls = tls ,
184+ ** connection_args ,
184185 )
185186 except LDAPException as ex :
186187 logger .warning ("LDAP connect failed: {ex}" .format (ex = ex ))
You can’t perform that action at this time.
0 commit comments