Changeset 2573


Ignore:
Timestamp:
11/06/07 14:24:25 (12 years ago)
Author:
pjkersha
Message:

ndg.security.server/ndg/security/server/MyProxy.py: added details for
Access Grid Toolkit Public License in respective of myproxy_logon used as a
basis for the code.

ndg.security.test/ndg/security/test/SessionCookie/SessionCookieTest.py:

  • fixed so that private key password is prompted for once only by keeping

it as a class var.

  • corrected call to create method.
Location:
TI12-security/trunk/python
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg.security.common/ndg/security/common/SessionCookie.py

    r2556 r2573  
    250250       
    251251       
    252     def create(self,dtExpiry=None,strExpiry=None,lifetime=28800,*morselArgs): 
     252    def create(self, 
     253               userDN, 
     254               sessID, 
     255               sessMgrURI, 
     256               dtExpiry=None, 
     257               strExpiry=None, 
     258               lifetime=28800,): 
    253259        '''Create an NDG Session cookie''' 
    254          
    255         if len(morselArgs) != self.__class__.nMorselArgs: 
    256             raise SessionCookieError, \ 
    257                         "Expecting three input parameters for cookie morsel" 
    258          
     260        morselArgs = userDN, sessID, sessMgrURI 
    259261        self.__userDN, self.__sessID, self.__sessMgrURI = morselArgs 
    260262                         
    261         morsel = morselArgs.join(self.__class__.morselArgSep) 
     263        morsel = self.__class__.morselArgSep.join(morselArgs) 
    262264        encrMorsel = self.__priKey.encrypt(morsel) 
    263265        b64EncMorsel = base64.encodestring(encrMorsel) 
  • TI12-security/trunk/python/ndg.security.server/ndg/security/server/MyProxy.py

    r2270 r2573  
    11"""MyProxy Client interface 
    22 
    3 Based on original program myproxy_logon Tom Uram <turam@mcs.anl.gov> 
    4  
    5 Also contains OpenSSLConfig class, a wrapper to the openssl configuration  
    6 file. 
    7  
    83NERC Data Grid Project 
    94 
    105@author P J Kershaw 02/06/05 
    116 
    12 Major re-write to implement methods with SSL calls with M2Crypto rather use 
    13 calls to myproxy client executables 
     7Major re-write of an original class.   This updated version implements methods 
     8with SSL calls with M2Crypto rather use calls to myproxy client executables as 
     9in the original.  This version is adapted and extended from an original  
     10program myproxy_logon by Tom Uram <turam@mcs.anl.gov> 
     11 
     12This module also contains OpenSSLConfig class, a wrapper to the openssl  
     13configuration file. 
     14 
     15For myproxy_logon see Access Grid Toolkit Public License (AGTPL):  
     16 
     17http://www-unix.mcs.anl.gov/fl/research/accessgrid/about/license.html 
     18 
     19This product includes software developed by and/or derived from the Access  
     20Grid Project (http://www.accessgrid.org) to which the U.S. Government retains  
     21certain rights.   
    1422 
    1523@copyright (C) 2006 CCLRC & NERC 
  • TI12-security/trunk/python/ndg.security.test/ndg/security/test/SessionCookie/SessionCookieTest.py

    r2558 r2573  
    1313""" 
    1414import unittest 
    15 import os, sys, getpass 
     15import os, sys, getpass, base64 
    1616  
    1717from ndg.security.common.SessionCookie import SessionCookie 
     
    2222class SessionCookieTestCase(unittest.TestCase): 
    2323     
     24    priKeyPwd = None 
     25         
    2426    def setUp(self): 
    2527        self.cookie = SessionCookie() 
     
    3032        self.cookie.x509CertFilePath = configParser.get('setUp',  
    3133                                                        'x509CertFilePath') 
    32         try: 
    33             priKeyPwd = configParser.get('setUp', 'priKeyPwd') 
    34         except NoOptionError: 
     34        if self.__class__.priKeyPwd is None: 
    3535            try: 
    36                 priKeyPwd = getpass.getpass(\ 
    37                             prompt="\nsetUp - private key password: ") 
    38             except KeyboardInterrupt: 
    39                 raise SystemExit 
     36                self.__class__.priKeyPwd = configParser.get('setUp',  
     37                                                            'priKeyPwd') 
     38            except NoOptionError: 
     39                try: 
     40                    self.__class__.priKeyPwd = getpass.getpass(\ 
     41                                prompt="\nsetUp - private key password: ") 
     42                    import pdb;pdb.set_trace() 
     43                except KeyboardInterrupt: 
     44                    raise SystemExit 
    4045         
    41         self.cookie.priKeyPwd = priKeyPwd 
     46        self.cookie.priKeyPwd = self.__class__.priKeyPwd 
    4247         
    4348        self.cookie.priKeyFilePath = configParser.get('setUp',  
    4449                                                      'priKeyFilePath') 
    4550       
    46         self.cookie.create() 
     51        self.cookie.create('O=NDG/OU=BADC/CN=test', 
     52                           base64.encodestring(os.urandom(32)), 
     53                           'http://localhost:5000/SessionManager') 
    4754         
    4855         
Note: See TracChangeset for help on using the changeset viewer.