MCPcopy Create free account
hub / github.com/apache/qpid-proton / test_client_authentication

Method test_client_authentication

python/tests/proton_tests/ssl.py:317–344  ·  view source on GitHub ↗

Force the client to authenticate.

(self)

Source from the content-addressed store, hash-verified

315 self.assertEqual(None, client.ssl._get_cert_fingerprint_unknown_hash_alg())
316
317 def test_client_authentication(self):
318 """ Force the client to authenticate.
319 """
320 # note: when requesting client auth, the server _must_ send its
321 # certificate, so make sure we configure one!
322 self.server_domain.set_credentials(self._testpath("server-certificate.pem"),
323 self._testpath("server-private-key.pem"),
324 "server-password")
325 self.server_domain.set_trusted_ca_db(self._testpath("ca-certificate.pem"))
326 self.server_domain.set_peer_authentication(SSLDomain.VERIFY_PEER,
327 self._testpath("ca-certificate.pem"))
328 server = SslTest.SslTestConnection(self.server_domain, mode=Transport.SERVER)
329
330 # give the client a certificate, but let's not require server authentication
331 self.client_domain.set_credentials(self._testpath("client-certificate.pem"),
332 self._testpath("client-private-key.pem"),
333 "client-password")
334 self.client_domain.set_peer_authentication(SSLDomain.ANONYMOUS_PEER)
335 client = SslTest.SslTestConnection(self.client_domain)
336
337 client.connection.open()
338 server.connection.open()
339 self._pump(client, server)
340
341 assert client.ssl.protocol_name() is not None
342 client.connection.close()
343 server.connection.close()
344 self._pump(client, server)
345
346 def test_client_authentication_fail_bad_cert(self):
347 """ Ensure that the server can detect a bad client certificate.

Callers

nothing calls this directly

Calls 7

_pumpMethod · 0.95
set_credentialsMethod · 0.45
set_trusted_ca_dbMethod · 0.45
openMethod · 0.45
protocol_nameMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected