MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / __configure_tls

Method __configure_tls

web/pgadmin/authenticate/ldap.py:212–231  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

210 return True, None
211
212 def __configure_tls(self):
213 ca_cert_file = getattr(config, 'LDAP_CA_CERT_FILE', None)
214 cert_file = getattr(config, 'LDAP_CERT_FILE', None)
215 key_file = getattr(config, 'LDAP_KEY_FILE', None)
216 cert_required = getattr(config, 'LDAP_CERT_VALIDATE', True)
217 cert_validate = ssl.CERT_REQUIRED if cert_required else ssl.CERT_NONE
218
219 try:
220 tls = Tls(
221 local_private_key_file=key_file,
222 local_certificate_file=cert_file,
223 validate=cert_validate,
224 version=ssl.PROTOCOL_TLSv1_2,
225 ca_certs_file=ca_cert_file)
226 except LDAPSSLConfigurationError as e:
227 current_app.logger.exception(
228 "LDAP configuration error: {}\n".format(e))
229 return False, gettext("LDAP configuration error: {}\n").format(
230 e.args[0])
231 return True, tls
232
233 def _configure_server(self):
234 # Parse the server URI

Callers 1

_configure_serverMethod · 0.95

Calls 1

gettextFunction · 0.85

Tested by

no test coverage detected