summaryrefslogtreecommitdiffstats
path: root/src/lib/simpleclient.py
diff options
context:
space:
mode:
authorJoey Hagedorn <hagedorn@mcs.anl.gov>2007-07-13 17:41:12 +0000
committerJoey Hagedorn <hagedorn@mcs.anl.gov>2007-07-13 17:41:12 +0000
commit0c97a66c15226197468654b83e19c79015dcf5d7 (patch)
treea3e61589cbb24b3668dcef760c0ea40103fe74a1 /src/lib/simpleclient.py
parent14063a8f707a5f8d715f0aab196615915c7ecb83 (diff)
downloadbcfg2-0c97a66c15226197468654b83e19c79015dcf5d7.tar.gz
bcfg2-0c97a66c15226197468654b83e19c79015dcf5d7.tar.bz2
bcfg2-0c97a66c15226197468654b83e19c79015dcf5d7.zip
adding new testing XML-RPC client/server code
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3437 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/simpleclient.py')
-rw-r--r--src/lib/simpleclient.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/lib/simpleclient.py b/src/lib/simpleclient.py
new file mode 100644
index 000000000..2840ea4eb
--- /dev/null
+++ b/src/lib/simpleclient.py
@@ -0,0 +1,32 @@
+from tlslite.api import XMLRPCTransport
+from xmlrpclib import ServerProxy
+from tlslite.integration.ClientHelper import ClientHelper
+
+#Authenticate server based on its X.509 fingerprint
+class DTXMLRPCTransport(XMLRPCTransport, ClientHelper):
+ def __init__(self,
+ username=None, password=None, sharedKey=None,
+ certChain=None, privateKey=None,
+ cryptoID=None, protocol=None,
+ x509Fingerprint=None,
+ x509TrustList=None, x509CommonName=None,
+ settings=None,
+ use_datetime=0):
+ self._use_datetime = use_datetime #this looks like a bug in tlslite. Perhaps just add this over there.
+ ClientHelper.__init__(self,
+ username, password, sharedKey,
+ certChain, privateKey,
+ cryptoID, protocol,
+ x509Fingerprint,
+ x509TrustList, x509CommonName,
+ settings)
+
+#sha1 fingerprint: ea38c8b6f73b5df8d77bf1e16652d9b8757a7310
+serverFingerprint = "ea38c8b6f73b5df8d77bf1e16652d9b8757a7310"
+
+transport = DTXMLRPCTransport(username="name", password="secret",x509Fingerprint=serverFingerprint.lower())
+server = ServerProxy("https://localhost:8505", transport)
+
+#print server.system.listMethods()
+
+print(server.silly("Kerbapp 1!")) \ No newline at end of file