18 from os.path
import exists
19 from httplib
import HTTPSConnection
20 from urllib2
import AbstractHTTPHandler
24 '''Class to authenticate via Grid Certificate'''
29 x509_path = getenv(
"X509_USER_PROXY",
None)
30 if x509_path
and exists(x509_path):
31 key_file = cert_file = x509_path
34 x509_path = getenv(
"X509_USER_KEY",
None)
35 if x509_path
and exists(x509_path):
39 x509_path = getenv(
"X509_USER_CERT",
None)
40 if x509_path
and exists(x509_path):
44 x509_path = getenv(
"HOME") +
"/.globus/userkey.pem"
49 x509_path = getenv(
"HOME") +
"/.globus/usercert.pem"
53 if not key_file
or not exists(key_file):
54 print >>stderr,
"No certificate private key file found"
57 if not cert_file
or not exists(cert_file):
58 print >>stderr,
"No certificate public key file found"
64 HTTPSConnection.__init__(self,
67 cert_file = cert_file,
74 return self.do_open(X509CertAuth, req)