test
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 20 of file authentication.py.

Constructor & Destructor Documentation

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

Definition at line 22 of file authentication.py.

References cmsRelvalreport.exit.

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