Commits

Mitsuhiro Koga committed c500bc8

svnwrap: Implement handling of ssl_client_cert_prompt_provider

Comments (0)

Files changed (3)

hgsubversion/svnrepo.py

         password = self.ui.getpass('Password for \'%s\': ' % (username,), default='')
         return (username, password, bool(may_save))
 
+    def ssl_client_cert(self, realm, may_save, pool=None):
+        self.maybe_print_realm(realm)
+        cert_file = self.ui.prompt('Client certificate filename: ', default='')
+        return (cert_file, bool(may_save))
+
     def ssl_server_trust(self, realm, failures, cert_info, may_save, pool=None):
         msg = 'Error validating server certificate for \'%s\':\n' % (realm,)
         if failures & svnwrap.SSL_UNKNOWNCA:

hgsubversion/svnwrap/subvertpy_wrapper.py

         def username(realm, may_save):
             return _prompt.username(realm, may_save)
 
+        def ssl_client_cert(realm, may_save):
+            return _prompt.ssl_client_cert(realm, may_save)
+
         def ssl_server_trust(realm, failures, cert_info, may_save):
             creds = _prompt.ssl_server_trust(realm, failures, cert_info, may_save)
             if creds is None:
             providers += [
                 ra.get_simple_prompt_provider(simple, 2),
                 ra.get_username_prompt_provider(username, 2),
+                ra.get_ssl_client_cert_prompt_provider(ssl_client_cert, 2),
                 ra.get_ssl_server_trust_prompt_provider(ssl_server_trust),
             ]
 

hgsubversion/svnwrap/svn_swig_wrapper.py

     (creds.username, creds.may_save) = ret
     return creds
 
+def _ssl_client_cert(realm, may_save, pool):
+    ret = _prompt.ssl_client_cert(realm, may_save, pool)
+    creds = core.svn_auth_cred_ssl_client_cert_t()
+    (creds.cert_file, creds.may_save) = ret
+    return creds
+
 def _ssl_server_trust(realm, failures, cert_info, may_save, pool):
     cert = [
             cert_info.hostname,
         providers += [
             client.get_simple_prompt_provider(_simple, 2),
             client.get_username_prompt_provider(_username, 2),
+            client.get_ssl_client_cert_prompt_provider(_ssl_client_cert, 2),
             client.get_ssl_server_trust_prompt_provider(_ssl_server_trust),
             ]