Changeset 492
- Timestamp:
- 03/10/05 11:54:26 (14 years ago)
- Location:
- security/trunk/python/Tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
security/trunk/python/Tests/ndgData.html
r486 r492 63 63 </td> 64 64 <td valign="top" width="127"> <a 65 href="javascript:ndgDataOpenWindow('../../cgi-bin/security.cgi?authorise=1', '_blank', 'scrollbars= no, resizable=no, width=512 ,height=468')">ACSOE65 href="javascript:ndgDataOpenWindow('../../cgi-bin/security.cgi?authorise=1', '_blank', 'scrollbars=yes, resizable=no, width=512 ,height=468')">ACSOE 66 66 data set 1</a> <br> 67 67 </td> -
security/trunk/python/Tests/security.py
r489 r492 134 134 # Authorisation and authentication arguments were set 135 135 # - Call authentication first 136 sessID= self.authenticate(setCookie=False)136 cookie = self.authenticate(setCookie=False) 137 137 138 138 # Call authorisation passing the session ID for authorise to 139 139 # set the cookie 140 self.authorise( sessID, extTrustedHost=extTrustedHost)140 self.authorise(cookie, extTrustedHost=extTrustedHost) 141 141 142 142 else: … … 356 356 resp = smSrv.connect(userName=self.__userName, 357 357 passPhrase=self.__passPhrase, 358 tracefile=sys.stderr)358 rtnAsCookie=True) 359 359 except socket.error, e: 360 360 # Socket error returns tuple - reformat to just give msg … … 364 364 raise SecurityCGIError(str(resp['errMsg'])) 365 365 366 sessID = str(resp['sessID'])366 cookie = str(resp['cookie']) 367 367 368 368 if setCookie: 369 # Make a cookie370 cookie = SimpleCookie()371 cookie['Hash'] = sessID372 369 373 370 print \ … … 382 379 <p>User %s authenticated</p> 383 380 <p>Cookie is: %s</p> 384 </body>""" % (cookie .output(), self.__userName, sessID)385 386 return sessID381 </body>""" % (cookie, self.__userName, cookie) 382 383 return cookie 387 384 388 385 except Exception, e: … … 411 408 #_________________________________________________________________________ 412 409 def authorise(self, 413 sessID=None,410 cookie=None, 414 411 reqRole='nercFunded', 415 412 extTrustedHost='', … … 418 415 access 419 416 420 sessID: session ID of user session, if omitted, use cookie417 cookie: cookie containing session ID 421 418 reqRole: required role to get authorisation - default to NERC for 422 419 testing""" … … 439 436 try: 440 437 # Check for session ID input 441 if isinstance(sessID, basestring): 442 443 # Set cookie 444 cookie = SimpleCookie() 445 cookie['Hash'] = sessID 438 if isinstance(cookie, basestring): 446 439 bSetCookie = True 440 441 # Get session ID from cookie 442 sessID = SimpleCookie(cookie)['Hash'].value 447 443 448 444 else: … … 503 499 # Handle access denied/granted 504 500 if bSetCookie: 505 cookieTxt = cookie .output()+ os.linesep501 cookieTxt = cookie + os.linesep 506 502 else: 507 503 cookieTxt = ''
Note: See TracChangeset
for help on using the changeset viewer.