Changeset 7781 for TI12-security


Ignore:
Timestamp:
15/12/10 16:40:02 (9 years ago)
Author:
pjkersha
Message:

Incomplete - task 16: NDG Security 2.x.x - incl. updated Paster templates

  • Added unit test for generic services template
Location:
TI12-security/trunk/NDGSecurity/python
Files:
1 added
4 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/NDGSecurity/python/ndg_security_server/ndg/security/server/paster_templates/Makefile

    r7777 r7781  
    166166         
    167167attribute_service_tmpl_clean: 
    168         @-echo Clearing Authorisation Service template ... 
     168        @-echo Clearing Attribute Service template ... 
    169169        rm -rf ${ATTR_SERVICE_DEST_DIR} 
    170170         
  • TI12-security/trunk/NDGSecurity/python/ndg_security_server/ndg/security/server/paster_templates/template.py

    r7777 r7781  
    3434    """ 
    3535    DEFAULT_PORT_NUM = 7443 
    36     DEFAULT_URI = urlparse.urlunsplit(('https', _hostname, '/', None, None)) 
     36    DEFAULT_URI = urlunsplit(('https', _hostname, '/', None, None)) 
    3737     
    3838    ATTRIBUTE_SERVICE_DEFAULT_MOUNT_POINT = '/AttributeService' 
     
    119119 
    120120        var('beakerSessionSecret',  
    121             ('Cookie secret for keeping security session state'), 
     121            'Cookie secret for keeping security session state', 
    122122            default=base64.b64encode(os.urandom(32))[:32]) 
    123123    ] 
     
    132132     
    133133    _template_dir = 'authorisationservice' 
    134     summary = ( 
    135         'Template to create an NDG Security Authorisation Service') 
     134    summary = 'Create an NDG Security Authorisation Service' 
    136135    vars = [ 
    137136        var('mountPoint',  
     
    153152class OpenIDProviderTemplate(Template): 
    154153    """Paster template for OpenID Provider service""" 
    155      
    156     DEFAULT_MOUNT_POINT = '/AuthorisationService' 
    157     DEFAULT_ISSUER_NAME = 'O=NDG, OU=Security, CN=localhost' 
    158     DEFAULT_ISSUER_FORMAT = Issuer.X509_SUBJECT 
    159      
    160     _template_dir = 'authorisationservice' 
     154    _template_dir = 'openid-provider' 
    161155    summary = ( 
    162156        'Template to create an NDG Security Authorisation Service') 
    163     vars = [ 
    164         var('mountPoint',  
    165             ('URI path to mount service i.e. https://myhost/<mountPoint>'), 
    166             default=DEFAULT_MOUNT_POINT), 
    167157 
    168         var('issuerName',  
    169             ('ID of this service used in SAML queries and responses'), 
    170             default=DEFAULT_ISSUER_NAME), 
    171  
    172         var('issuerFormat',  
    173             ('Format of issuerName string; if using the default, ensure that ' 
    174              'the issuerName value is a correctly formatted X.509 Subject ' 
    175              'Name'), 
    176             default=DEFAULT_ISSUER_FORMAT) 
  • TI12-security/trunk/NDGSecurity/python/ndg_security_server/setup.py

    r7756 r7781  
    3636    main=pylons.util:PylonsInstaller 
    3737    [paste.paster_create_template] 
     38    ndgsecurity_services=ndg.security.server.paster_templates.template:ServicesTemplate 
    3839    ndgsecurity_authorisation_service=ndg.security.server.paster_templates.template:AuthorisationServiceTemplate 
    3940    """ 
  • TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/integration/full_system/securityservices.ini

    r7777 r7781  
    140140# Apply verification against a list of trusted CAs.  To skip this step, comment 
    141141# out or remove this item.  e.g. set CA verification in the Apache config file. 
    142 ssl.caCertFilePathList = %(testConfigDir)s/ca/d573507a.0 
     142ssl.caCertFilePathList = %(testConfigDir)s/pki/ca/d573507a.0 
    143143 
    144144# Apply whitelisting of client certificate DNs.  This should never be needed in 
     
    580580authz.ctx_handler.pip.attributeQuery.sslCertFilePath = %(testConfigDir)s/pki/localhost.crt 
    581581authz.ctx_handler.pip.attributeQuery.sslPriKeyFilePath = %(testConfigDir)s/pki/localhost.key 
    582 authz.ctx_handler.pip.attributeQuery.sslCACertDir = %(testConfigDir)s/ca 
     582authz.ctx_handler.pip.attributeQuery.sslCACertDir = %(testConfigDir)s/pki/ca 
    583583 
    584584#______________________________________________________________________________ 
     
    588588 
    589589[handlers] 
    590 keys = console 
     590keys = console, logfile 
    591591 
    592592[formatters] 
     
    612612datefmt = %Y-%m-%d %H:%M:%S 
    613613 
     614[handler_logfile] 
     615class = handlers.RotatingFileHandler 
     616level=NOTSET 
     617formatter=generic 
     618args=(os.path.join('%(here)s', 'log', 'service.log'), 'a', 50000, 2) 
  • TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/unit/paster_templates/test_paster_templates.py

    r7756 r7781  
    99from paste.script.create_distro import CreateDistroCommand 
    1010 
    11 from ndg.security.server.paster_templates.template import \ 
    12     AuthorisationServiceTemplate 
     11from ndg.security.server.paster_templates.template import (ServicesTemplate, 
     12    AuthorisationServiceTemplate) 
     13      
     14 
     15class ServicesTemplateTestCase(unittest.TestCase): 
     16    """Test create configuration for an application which bundles all the NDG  
     17    Security Services 
     18    """ 
     19    HERE_DIR = path.dirname(path.abspath(__file__)) 
     20    SERVICE_TMPL_NAME = 'ndgsecurity_services' 
     21    SERVICE_CONF_DIR = 'services' 
     22    SERVICE_CONF_DIRPATH = path.join(HERE_DIR, SERVICE_CONF_DIR) 
     23    SERVICE_CONF_DIR_FILES = ( 
     24        'pki', 'pip-mapping.txt', 'service.ini', 'policy.xml', 'user.db' 
     25    ) 
    1326     
     27    def test01Run(self): 
     28        cmd = CreateDistroCommand(None) 
     29        cmd.default_interactive = False 
     30        cmd.run([self.__class__.SERVICE_CONF_DIR,  
     31                 '-t',  
     32                 self.__class__.SERVICE_TMPL_NAME]) 
     33         
     34        createdFiles = listdir(self.__class__.SERVICE_CONF_DIRPATH) 
     35         
     36        for _file in self.__class__.SERVICE_CONF_DIR_FILES: 
     37            self.assert_(_file in createdFiles, "Missing file %r" % _file) 
     38 
     39    def tearDown(self): 
     40        shutil.rmtree(self.__class__.SERVICE_CONF_DIRPATH, True) 
     41            
    1442 
    1543class AuthorisationServiceTemplateTestCase(unittest.TestCase): 
     44    """Test creation of ini file and basic configuration settings for NDG  
     45    Security Authorisation Service 
     46    """ 
    1647    HERE_DIR = path.dirname(path.abspath(__file__)) 
    1748    TMPL_CONFIG_FILEPATH = path.join(HERE_DIR, 'template.cfg') 
     
    4071        shutil.rmtree(self.__class__.AUTHORISATION_SERVICE_CONF_DIRPATH, True) 
    4172 
     73 
    4274if __name__ == "__main__": 
    4375    unittest.main() 
Note: See TracChangeset for help on using the changeset viewer.