Changeset 625
- Timestamp:
- 16/02/06 09:08:49 (15 years ago)
- Location:
- TI12-security/trunk/python
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TI12-security/trunk/python/NDG/AttAuthority.py
r543 r625 164 164 raise AttAuthorityError('Importing User Roles module: %s' % e) 165 165 166 167 166 # Check class inherits from AAUserRoles abstract base class 168 167 if not issubclass(usrRolesClass, AAUserRoles): 169 168 raise AttAuthorityError(\ 170 169 "User Roles class %s must be derived from AAUserRoles" % \ 171 usrRolesClassName)170 self.__prop['usrRolesClassName']) 172 171 173 172 -
TI12-security/trunk/python/NDG/SessionClient.py
r546 r625 137 137 pPhrase=pPhrase, 138 138 encrPubKeyFilePath=smEncrPubKeyFilePath) 139 139 140 140 # Pass encrypted request 141 resp = self.__smSrv.addUser(addUserReq=addUserReq()) 141 resp = self.__smSrv.addUser(addUserReq=addUserReq()) 142 142 addUserResp = AddUserResp(xmlTxt=str(resp['addUserResp'])) 143 if 'errMsg' in addUserResp and 'errMsg':143 if 'errMsg' in addUserResp and addUserResp['errMsg']: 144 144 raise SessionClientError(addUserResp['errMsg']) 145 145 146 146 except Exception, e: 147 raise SessionClientError("Error : " + str(e))147 raise SessionClientError("Error adding new user: " + str(e)) 148 148 149 149 … … 194 194 resp = self.__smSrv.connect(connectReq=connectReq()) 195 195 connectResp = ConnectResp(xmlTxt=str(resp['connectResp'])) 196 if 'errMsg' in connectResp and 'errMsg':196 if 'errMsg' in connectResp and connectResp['errMsg']: 197 197 raise Exception(connectResp['errMsg']) 198 198 … … 294 294 smEncrPubKeyFilePath = '../certs/badc-sm-cert.pem' 295 295 296 userName = ' selatham'#'pjkersha'296 userName = 'aharwood'#'pjkersha' 297 297 298 298 sessClnt = SessionClient(smWSDL=smWSDL, … … 300 300 traceFile=sys.stderr) 301 301 302 #sessClnt.addUser(userName, pPhraseFilePath="../tmp")303 sSessCookie = sessClnt.connect(userName, pPhraseFilePath="../tmp")304 sessCookie = SimpleCookie(sSessCookie)305 authResp = sessClnt.reqAuthorisation(sessCookie['NDG-ID1'].value,306 sessCookie['NDG-ID2'].value,307 aaWSDL=aaWSDL)302 sessClnt.addUser(userName, pPhraseFilePath="../tmp") 303 # sSessCookie = sessClnt.connect(userName, pPhraseFilePath="../tmp") 304 # sessCookie = SimpleCookie(sSessCookie) 305 # authResp = sessClnt.reqAuthorisation(sessCookie['NDG-ID1'].value, 306 # sessCookie['NDG-ID2'].value, 307 # aaWSDL=aaWSDL) 308 308 print authResp 309 309 -
TI12-security/trunk/python/NDG/SimpleCAClient.py
r527 r625 177 177 # Get properties from file as a data dictionary cutting out leading 178 178 # and trailing white space 179 prop = dict([(elem.tag, elem.text.strip()) for elem in propElem]) 179 prop = {} 180 for elem in propElem: 181 182 # Check for environment variables in file paths 183 tagCaps = elem.tag.upper() 184 if 'FILE' in tagCaps or 'PATH' in tagCaps or 'DIR' in tagCaps: 185 elem.text = os.path.expandvars(elem.text) 186 187 prop[elem.tag] = elem.text.strip() 180 188 181 189 # Update any existing values -
TI12-security/trunk/python/Tests/security.py
r546 r625 22 22 from ZSI import ServiceProxy 23 23 24 #if 'LD_LIBRARY_PATH' in os.environ: 25 # os.environ['LD_LIBRARY_PATH'] += ":/usr/local/NDG-Security/lib" 26 #else: 27 # os.environ['LD_LIBRARY_PATH'] = "/usr/local/NDG-Security/lib" 28 # 29 #print "LD_LIBRARY_PATH=" + os.environ['LD_LIBRARY_PATH'] 30 24 31 from NDG.AttCert import * 25 32 from NDG.SessionClient import * … … 47 54 passPhrase=None, 48 55 smEncrPubKeyFilePath=None, 49 org=None): 56 org=None, 57 bDebug=False): 50 58 """Omit username, passphrase and org if running from CGI""" 51 59 … … 55 63 self.__passPhrase = passPhrase 56 64 self.__smEncrPubKeyFilePath = smEncrPubKeyFilePath 57 65 self.__bDebug = bDebug 58 66 59 67 # Authenticating organisation … … 224 232 <tr><td>User Name:</td> <td><input type=text name=userName value="">@ 225 233 <select name="org"> 234 <option>BODC</option> 226 235 <option>BADC</option> 227 <option>BODC</option>228 236 <option>PML</option> 229 237 <option>NOCS</option> … … 270 278 271 279 #_________________________________________________________________________ 272 def addUser(self , bDebug=False):280 def addUser(self): 273 281 """Add a new NDG User account""" 274 282 … … 279 287 raise SecurityCGIError("No passphrase set") 280 288 281 if bDebug:289 if self.__bDebug: 282 290 traceFile = sys.stderr 283 291 else: 284 292 traceFile = None 285 286 293 287 294 try: 288 295 # Instantiate WS proxy and request connection … … 294 301 295 302 296 resp =smClient.addUser(userName=self.__userName,297 303 smClient.addUser(userName=self.__userName, 304 pPhrase=self.__passPhrase) 298 305 except Exception, e: 299 # Socket error returns tuple - reformat to just give msg300 306 raise SecurityCGIError("Session Client: " + str(e)) 301 302 if resp['errMsg']:303 raise SecurityCGIError(str(resp['errMsg']))304 307 305 308 print \ … … 337 340 338 341 #_________________________________________________________________________ 339 def authenticate(self, setCookie=True, bAuthorise=False , bDebug=False):342 def authenticate(self, setCookie=True, bAuthorise=False): 340 343 """Authenticate username and passphrase input from preceeding login 341 344 form … … 344 347 recalled followed by authorisation""" 345 348 346 if bDebug:349 if self.__bDebug: 347 350 traceFile = sys.stderr 348 351 else: … … 417 420 cookie=None, 418 421 reqRole='nercFunded', 419 extTrustedHost='', 420 bDebug=True): 422 extTrustedHost=''): 421 423 """Contact Attribute Authority to get Attribute Certificate for data 422 424 access … … 426 428 testing""" 427 429 428 if bDebug:430 if self.__bDebug: 429 431 traceFile = sys.stderr 430 432 else: … … 701 703 smWSDL = "http://glue.badc.rl.ac.uk/sessionMgr.wsdl" 702 704 aaWSDL = "http://glue.badc.rl.ac.uk/attAuthority.wsdl" 703 smPubKey = os.path.expandvars("/usr/local/NDG/conf/certs/badc-sm-cert.pem")705 smPubKey = "/usr/local/NDG/conf/certs/badc-sm-cert.pem" 704 706 707 705 708 # Instantiate and call CGI 706 security = SecurityCGI(smWSDL, aaWSDL, smEncrPubKeyFilePath=smPubKey) 709 security = SecurityCGI(smWSDL, 710 aaWSDL, 711 smEncrPubKeyFilePath=smPubKey, 712 bDebug=True) 707 713 security.cgi()
Note: See TracChangeset
for help on using the changeset viewer.