CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
authentication.X509CertAuth Class Reference
Inheritance diagram for authentication.X509CertAuth:

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.

References cmsRelvalreport.exit.

25 
26  def __init__(self, host, *args, **kwargs):
27  key_file = None
28  cert_file = None
29 
30  x509_path = getenv("X509_USER_PROXY", None)
31  if x509_path and exists(x509_path):
32  key_file = cert_file = x509_path
33 
34  if not key_file:
35  x509_path = getenv("X509_USER_KEY", None)
36  if x509_path and exists(x509_path):
37  key_file = x509_path
38 
39  if not cert_file:
40  x509_path = getenv("X509_USER_CERT", None)
41  if x509_path and exists(x509_path):
42  cert_file = x509_path
43 
44  if not key_file:
45  x509_path = getenv("HOME") + "/.globus/userkey.pem"
46  if exists(x509_path):
47  key_file = x509_path
48 
49  if not cert_file:
50  x509_path = getenv("HOME") + "/.globus/usercert.pem"
51  if exists(x509_path):
52  cert_file = x509_path
53 
54  if not key_file or not exists(key_file):
55  print >>stderr, "No certificate private key file found"
56  exit(1)
57 
58  if not cert_file or not exists(cert_file):
59  print >>stderr, "No certificate public key file found"
60  exit(1)
61 
62  #print "Using SSL private key", key_file
63  #print "Using SSL public key", cert_file
64 
65  HTTPSConnection.__init__(self,
66  host,
67  key_file = key_file,
68  cert_file = cert_file,
69  **kwargs)
70 
71 #-----------------------------------------------------------------------------