Changeset 968


Ignore:
Timestamp:
19/05/06 18:40:30 (13 years ago)
Author:
pjkersha
Message:

Tests/GatekeeperClientTest?.py: test Gatekeeper WS client.

Tests/AttAuthorityClientTest?.py: renamed methods so that called automatically when script is
invoked with no args.

Tests/SecurityClientTest?.py: set user to 'laurence' in order to get ACs with more roles set.

bin/LogServer.py: typo fix logs -> log

bin/GatekeeperServer.py: working version

NDG/TestGatekeeperResrc.py: test harness for Gatekeeper resource interface

NDG/gatekeeper_services_server.py: working but logic for returning matching roles needs fixing.

NDG/GatekeeperClient.py: client interface class to Gatekeeper WS.

NDG/Gatekeeper.py: working version

NDG/gatekeeper_services.py: regenerated following changes to WSDL.

Location:
TI12-security/trunk/python
Files:
6 added
4 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/NDG/Gatekeeper.py

    r964 r968  
    1818# Alter system path for dynamic import of resource interface class 
    1919import sys 
     20 
     21# Expand environment vars in paths 
     22import os 
    2023 
    2124from AttCert import * 
     
    3841    Certificate can access a given resource.""" 
    3942     
    40     __validKeys = ( 'resrcURI', 
     43    __validKeys = ( 'resrcID', 
    4144                    'resrcModFilePath', 
    4245                    'resrcModName', 
     
    100103        # Check class inherits from GatekeeperResrc abstract base class 
    101104        if not issubclass(resrcClass, GatekeeperResrc): 
    102             raise GatekeeperError(\ 
    103                 "Resource URI interface class %s must be derived from " + \ 
    104                 "GatekeeperResrc" % self.__prop['resrcClassName']) 
     105            raise GatekeeperError, \ 
     106                "Resource interface class %s must be derived from " % \ 
     107                self.__prop['resrcClassName'] + "GatekeeperResrc" 
    105108 
    106109 
     
    140143                                 
    141144        # Copy properties from file as dictionary 
    142         self.__prop = dict([(elem.tag, elem.text) for elem in elems]) 
     145        # 
     146        # Nb. # Allow for environment variables in paths 
     147        self.__prop.update(dict([(elem.tag,  
     148                                  os.path.expandvars(elem.text.strip())) \ 
     149                                 for elem in elems if elem.text is not None])) 
    143150 
    144151 
     
    169176            # Check signature of AttCert 
    170177            try: 
    171                 attCert.isValid(raiseExcep=True,  
     178                input.isValid(raiseExcep=True,  
    172179                            certFilePathList=self.__prop['caCertFilePath'])                             
    173180            except Exception, e: 
    174                 raise GateKeeperError, "Access denied for input: %s" % str(e) 
     181                raise GatekeeperError, "Access denied for input: %s" % str(e) 
    175182             
    176183            return input.getRoles() 
     
    241248 
    242249#_____________________________________________________________________________ 
    243 class GatekeeperResrcError(GateKeeperError): 
     250class GatekeeperResrcError(GatekeeperError): 
    244251    """Exception handling for NDG Gatekeeper Resource interface class 
    245252    class.""" 
  • TI12-security/trunk/python/Tests/AttAuthorityClientTest.py

    r848 r968  
    4040     
    4141     
    42     def getPubKeyTest(self): 
     42    def testGetPubKey(self): 
    4343        try: 
    4444            # Request an attribute certificate from an Attribute Authority  
     
    5959 
    6060 
    61     def getTrustedHostInfoTest(self): 
     61    def testGetTrustedHostInfo(self): 
    6262         
    6363        try: 
     
    6767 
    6868 
    69     def reqAuthorisationTest(self):         
     69    def testReqAuthorisation(self):         
    7070        """Request authorisation from NDG Attribute Authority Web Service.""" 
    7171     
     
    105105                 
    106106            except IOError, ioErr: 
    107                 raise "Error reading attribute certificate file \"%s\": %s" % \ 
     107                raise "Error reading attribute certificate file \"%s\": %s" %\ 
    108108                                        (ioErr.filename, ioErr.strerror) 
    109109        else: 
     
    130130        map = map(attAuthorityClientTestCase, 
    131131                  ( 
    132                     "getTrustedHostInfoTest", 
    133                     "reqAuthorisationTest", 
    134                     "getPubKeyTest", 
     132                    "testGetTrustedHostInfo", 
     133                    "testReqAuthorisation", 
     134                    "testGetPubKey", 
    135135                  )) 
    136136        unittest.TestSuite.__init__(self, map) 
  • TI12-security/trunk/python/Tests/SecurityClientTest.py

    r964 r968  
    8585    def cookieConnectTest(self): 
    8686         
    87         userName = 'pjkersha' 
     87        userName = 'lawrence' 
    8888        try: 
    8989            # Connect as if acting as a browser client - a cookie is returned 
     
    101101    def proxyCertConnectTest(self): 
    102102         
    103         userName = 'pjkersha' 
     103        userName = 'lawrence' 
    104104         
    105105        try: 
  • TI12-security/trunk/python/bin/LogServer.py

    r917 r968  
    8989                      dest="logFilePath", 
    9090                      help=\ 
    91                 "file path for log file to log to - default is $NDG_DIR/logs") 
     91                "file path for log file to log to - default is $NDG_DIR/log") 
    9292 
    9393    parser.add_option("-d",  
Note: See TracChangeset for help on using the changeset viewer.