CMS 3D CMS Logo

Public Member Functions

authentication::X509CertAuth Class Reference

Inherits httpslib::HTTPSConnection.

List of all members.

Public Member Functions

def __init__

Detailed Description

Class to authenticate via Grid Certificate

Definition at line 23 of file authentication.py.


Constructor & Destructor Documentation

def authentication::X509CertAuth::__init__ (   self,
  host,
  args,
  kwargs 
)

Definition at line 25 of file authentication.py.

00026                                            :
00027     key_file = None
00028     cert_file = None
00029 
00030     x509_path = getenv("X509_USER_PROXY", None)
00031     if x509_path and exists(x509_path):
00032       key_file = cert_file = x509_path
00033 
00034     if not key_file:
00035       x509_path = getenv("X509_USER_KEY", None)
00036       if x509_path and exists(x509_path):
00037         key_file = x509_path
00038 
00039     if not cert_file:
00040       x509_path = getenv("X509_USER_CERT", None)
00041       if x509_path and exists(x509_path):
00042         cert_file = x509_path
00043 
00044     if not key_file:
00045       x509_path = getenv("HOME") + "/.globus/userkey.pem"
00046       if exists(x509_path):
00047         key_file = x509_path
00048 
00049     if not cert_file:
00050       x509_path = getenv("HOME") + "/.globus/usercert.pem"
00051       if exists(x509_path):
00052         cert_file = x509_path
00053 
00054     if not key_file or not exists(key_file):
00055       print >>stderr, "No certificate private key file found"
00056       exit(1)
00057 
00058     if not cert_file or not exists(cert_file):
00059       print >>stderr, "No certificate public key file found"
00060       exit(1)
00061 
00062     #print "Using SSL private key", key_file
00063     #print "Using SSL public key", cert_file
00064     
00065     HTTPSConnection.__init__(self, 
00066                               host,
00067                               key_file = key_file,
00068                               cert_file = cert_file,
00069                               **kwargs)
00070 
00071 #-----------------------------------------------------------------------------